Open simona1245 opened 1 year ago
Name | Link |
---|---|
Latest commit | 82e23dde6c0ce5cc48d809a6f7570c86993927f3 |
Latest deploy log | https://app.netlify.com/sites/evergreen-storybook/deploys/639784d5b8f1b10008030fb4 |
Deploy Preview | https://deploy-preview-1575--evergreen-storybook.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
Thanks for taking a look at this @simona1245!
I pulled it down and gave it a run myself, and it does seem to trap focus as expected. One potential issue I noticed is that it no longer closes the dialog when you click outside of it. I'm not entirely sure whether we should have this behavior, but it will be a breaking change if we keep it as-is. I'm going to dig into web accessibility standards a bit and see what I can find.
Hmm, after taking a look at what Paste does, they actually split out two variants of what looks like our Dialog
component that are for different use cases:
https://paste.twilio.design/components/modal
This seems to be more or less our Dialog component, i.e. it closes on an outside click (but it is accessible in that it traps focus inside, handles escape to close, etc)
https://paste.twilio.design/components/alert-dialog
I think this is closer to what the proposed implementation in this PR is - same visual styling as their Modal component, but closing the AlertDialog has to be explicitly done with the Cancel/Confirmation action (escape does not close it either).
We're in somewhat of a middle state between these two variants. In the interest of backwards compatibility, can we figure out how to maintain the outside-click-to-close behavior?
as of the documentation and thorough internet searching about "tab focusing" it is clear that creating tab focus from scratch is not applicable. (see stackoverflow)
Library to add: react-focus-trap