-
Notifications
You must be signed in to change notification settings - Fork 646
Overlay: Add role="dialog", focus trap to Overlay
#4990
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
Conversation
🦋 Changeset detectedLatest commit: 5627e4f 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 |
size-limit report 📦
|
role="dialog", focus trap to Overlay`role="dialog", focus trap to Overlay
|
👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/343407 |
|
This change essentially turns Rollout plan:
|
| portalContainerName?: string | ||
| preventFocusOnOpen?: boolean | ||
| role?: AriaRole | ||
| focusTrap?: boolean |
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.
Added a new prop in case there's an implementation that wants to be a dialog, but doesn't want the focus trap applied. This is a very specific case, and ideally won't be necessary in more than a handful of instances.
|
@primer/engineer-reviewers - Hey team! Would love any additional eyes on this PR, mainly in regards to my rollout plan. |
francinelucca
left a comment
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.
LGTM! One minor suggestion and one question:
https://github.com/github/primer/issues/3378 suggests:
allow users to switch to/from the non-modal dialog using
Ctrl+F6/Command+F6
Did we implement that? I couldn't get that to go in my tests
| }, | ||
| { | ||
| "name": "focusTrap", | ||
| "type": "string", |
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.
should this be a boolean instead?
| "type": "string", | |
| "type": "boolean", |
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.
If it is a role=dialog and has focus trapping, it should be a <dialog> element with showModal() called.
We should steer away from useFocusTrap and use showModal() on <dialog> elements instead. It comes with many other small benefits such as retaining previously-focused-element.
If you need any assistance on this please reach out and I'll happily pair.
That makes sense! I'm curious if we'd want this to be true for components that consume Right now, this PR will only affect components that utilize |
|
I think As for conditionally rendering |
Closes https://github.com/github/primer/issues/3378
Usages of
Overlaytend to lean more towards a dialog across GH. This PR aims to define it as adialogin most cases, provided with a focus trap that's toggled via the newly addedfocusTrapprop.Changelog
New
role="dialog"andaria-modal="true"toOverlaycomponentRollout strategy
Testing & Reviewing
Merge checklist