Skip to content

How to toggle focus trap in RAC modal/dialog #6000

Answered by devongovett
Niznikr asked this question in Q&A
Discussion options

You must be logged in to vote

We probably need to add this to the docs, but cases like this can be handled with the data-react-aria-top-layer attribute. This is a way of marking certain elements as appearing above all others in an application, so the user always has access to them (e.g. via keyboard focus and screen readers). Another example of a top layer element is a toast. If you can add the data-react-aria-top-layer attribute to the CommandBar element, or an ancestor (e.g. a container that it renders into), then React Aria will allow focus to move to any element inside it.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Niznikr
Comment options

@stevegreco
Comment options

Answer selected by Niznikr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants