-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Prevent scrolling while popovers are open #2926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think to prevent scrolling will be less desirable from an accessibility standpoint than repositioning the overlay on scroll. When a the full contents of an overlay cannot fit within the visible viewport, as will sometimes be the case when a user has zoomed the browser, a user will need to be able to scroll the overlay into view to read the content. With good support for Success Criterion 1.4.10 Reflow, the need for scroll can be mitigated, but there are still cases where some or all of an overlay's content might display outside the visible viewport and where scrolling without closing the overlay will be necessary. See: #2842 (comment) Related success criteria: |
To test: EDIT: pinch zooming on Dialogs currently works w/ Android |
Uh oh!
There was an error while loading. Please reload this page.
🙋 Feature Request
We currently allow the page to scroll while popovers and menus are visible, and hide them when scrolling occurs to avoid janky repositioning. However, this leads to usability issues (e.g. #900, #1852, #2766). Instead, we should prevent scrolling from occurring outside the popover while it is visible similar to what we do for modals.
🤔 Expected Behavior
When a popover is visible, prevent the page from scrolling using the
usePreventScroll
hook. However, this does not prevent scrolling nested scrollable regions (e.g. tables and other collections), so we will also need a way to handle those somehow. The easiest way would probably be to render an underlay like we do for modals, except make it fully transparent.We already prevent clicking on external elements while popovers are open, so this would extend that behavior so it also affects hover which I think makes sense as well.
Not sure if this is considered a breaking change. We will need to discuss whether it is behind an option for the
useOverlay
hook or just becomes the new default.🧢 Your Company/Team
RSP
The text was updated successfully, but these errors were encountered: