-
Notifications
You must be signed in to change notification settings - Fork 130
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
Fix SidePanel and Modal issues on Safari #1498
Conversation
🦋 Changeset detectedLatest commit: 4701742 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/sumup/oss-circuit-ui/9HQ9syp8v44wZm7vFUgQtpedkrU8 |
Hey @hris27, Thanks! |
Codecov Report
@@ Coverage Diff @@
## main #1498 +/- ##
=======================================
Coverage 92.33% 92.33%
=======================================
Files 201 201
Lines 4213 4213
Branches 1321 1321
=======================================
Hits 3890 3890
Misses 304 304
Partials 19 19
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, though I would love @robinmetral's opinion on the a11y-related changes once he's back from vacay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for addressing this and for the thorough context @hris27, that's a really interesting issue! reactjs/react-modal#389 lays it out really well and even links to the related docs on MDN 💯
I don't think preventing scroll will cause any accessibility problems. We could manually return focus to the trigger element in Safari and FF on macOS for consistency (as suggested in reactjs/react-modal#858 (comment)), but I'd rather keep our implementation leaner and let react-modal
address this (it's been mentioned in the plans for v5 🤞)
Great, thanks @robinmetral. I'm going to merge this in |
Purpose
SidePanel
andModal
was broken on Safari and was fixed inreact-modal@3.14.1
.SidePanel
orModal
the focus is returned to thebody
(or thefocus-root
created by@reach/router
in the case of the Dashboard) which may cause an unwanted page scroll.Approach and changes
react-modal
to the latest release - v3.14.4.preventScroll
prop which would prevent the page from scrolling when the trigger element is not visible. This can happen if the user scrolls the main content while the side panel is visible. This should not cause any accessibility issues as we don't expect the main content to be scrolled when using keyboard navigation because of the focus trap. For mouse users it would actually improve the UX by not scrolling back to the trigger element after closing the side panel.Definition of done