ember-basic-dropdown
ember-basic-dropdown copied to clipboard
Using the browser scrollbar closes the dropdown
Although you can still scroll the page with a mouse scrollwheel for example, it's a bit of a usability issue if you can't also use the scrollbars built into the browser.
I've added a gif to illustrate -- this is more of a problem with bigger dropdowns.
I think is unavoidable really as clicking outside the component closes it. You can make the component stay open by returning false from the onClose action (see http://ember-basic-dropdown.com/docs/dropdown-events).
That action will receive the mousedown event as second argument, but i don't think there is a way to detect the user has clicked in a scroll bar. If I'm wrong please tell me. I don't know if it's possible to detect that the user clicked
I once thought as you did, but I happened to notice that drop.js does not have this issue -- it looks to be because rather than binding to document.mousedown to detect a mouse event outside the popover, they bind to document.click. I'm speculating a little, but it seems like the scrollbar doesn't fire a document.click event because the browser has already handled it.
document.mousedown seems to be closer to the metal though. Just curious: were there edge cases that you were avoiding by using document.mousedown instead of document.click?
I see. The reason why this component uses onmousedown is because it was initially extracted from Ember Power Select, and selects open and close on mousedown, not on click. Since this component is more generic than a select opening on click should, at least, be an allowed option which would also fix your complaint.
I'm on holidays right now, but it seems like a feature request.
By all means, have a good holiday! Thanks for checking in, in the meanwhile :grin: