|
The issue I am facing is when a user attempts to drag-select text in an input, but their mouse movement continues beyond the end of the input and the mouseup event occurs outside of the column options div. The column options is hidden and they expect it to stay open. Should the column options close only when a mousedown event occurs outside of the column options? Can I capture and suppress the mouseup event? |
Replies: 1 comment
|
It's the QuickGrid puts two close handlers on document.body.addEventListener('click', bodyClickHandler);
document.body.addEventListener('mousedown', bodyClickHandler); // Otherwise it seems strange that it doesn't go away until you release the mouse button
Nothing bubbles out of your let pressedInside = false;
const inside = t => t instanceof Element && t.closest('.col-options');
document.addEventListener('mousedown', e => {
pressedInside = !!inside(e.target);
}, true);
document.addEventListener('click', e => {
const suppress = pressedInside && e.detail > 0 && !inside(e.target);
pressedInside = false;
if (suppress) {
e.stopPropagation();
}
}, true);Two details matter there. Reset To your first question: yes, closing only on a |
It's the
clicklistener rather thanmouseup, and there's no way to suppress it from Blazor markup right now.QuickGrid puts two close handlers on
document.bodyinQuickGrid.razor.js:bodyClickHandlercloses the popup wheneverevent.composedPath()doesn't include.col-options(src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.js, lines 3 to 8, registered on lines 16 and 17). Themousedownhalf isn't your problem, since the press starts inside the…