Skip to content

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

Closed
devongovett opened this issue Mar 4, 2022 · 3 comments · Fixed by #3475
Closed

Prevent scrolling while popovers are open #2926

devongovett opened this issue Mar 4, 2022 · 3 comments · Fixed by #3475
Assignees
Labels
enhancement New feature or request

Comments

@devongovett
Copy link
Member

devongovett commented Mar 4, 2022

🙋 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

@devongovett devongovett added the enhancement New feature or request label Mar 4, 2022
@majornista
Copy link
Collaborator

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:
https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus and https://www.w3.org/TR/WCAG21/#reflow

@LFDanLu
Copy link
Member

LFDanLu commented Aug 24, 2022

To test:
pinch zooming of dialogs
other methods of zoom (CMD +, pinch zooming, other magnification tools)

EDIT: pinch zooming on Dialogs currently works w/ Android

@LFDanLu LFDanLu moved this from To Groom to Waiting for Sprint in RSP Component Milestones Aug 24, 2022
@reidbarber reidbarber moved this from 📋 Waiting for Sprint to 👀 In Review in RSP Component Milestones Sep 2, 2022
@dannify dannify moved this from 👀 In Review to ✅ Done in RSP Component Milestones Sep 8, 2022
@reidbarber reidbarber moved this from ✅ Done to 👀 In Review in RSP Component Milestones Sep 8, 2022
@majornista
Copy link
Collaborator

For the record, while tangentially related because it involves the prevent scrolling behavior of focusSafely, this issue and the related PR #3475 do not resolve #2766, which has its own fix in PR #2767.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants