ibm-js / delite

HTML Custom Element / Widget infrastructure
http://ibm-js.github.io/delite/
Other
68 stars 28 forks source link

Close dropdown when anchor node scrolled out of view #508

Closed wkeese closed 5 years ago

wkeese commented 5 years ago

Typically, popups/dropdowns are closed when the user scrolls the page or the anchor node's containing <div>. Of course, they must remain open when the user scrolls inside the popup itself.

The problem happens when scrolling by trackpad or mouse wheel, or on mobile devices without a scrollbar. In those cases, the popup is not automatically closed, because it's possible the user was scrolling inside the popup, reached the end, and inadvertently scrolled the main page (or anchor node's containing <div>). However, when the anchor node is scrolled completely out of view, it's strange to leave the dropdown open, because it's just hanging in mid-air.