You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will start navigating on elements behind the dialog and across the codesandbox window
Suggested solution
I'm not familiar with the code, but I imagine FocusScope is responsible for trapping the focus inside when mounted. However, there might be some use cases where you folks intended to use FocusScope without trapping the focus on mount. If that’s the case, I think Dialog/AlertDialog should pass a prop to FocusScope to ensure it traps the focus on mount.
Bug report
Current Behavior
In certain conditions, if you have a dialog, you can still navigate through elements outside the dialog using the tab key right after you open it.
CleanShot.2024-09-11.at.15.02.01.mp4
Expected behavior
The dialog should trap the focus when opened and not let it leave until it’s closed.
Reproducible example
CodeSandbox Template
Suggested solution
I'm not familiar with the code, but I imagine
FocusScope
is responsible for trapping the focus inside when mounted. However, there might be some use cases where you folks intended to useFocusScope
without trapping the focus on mount. If that’s the case, I thinkDialog
/AlertDialog
should pass a prop toFocusScope
to ensure it traps the focus on mount.https://github.com/radix-ui/primitives/tree/main/packages/react/focus-scope
Additional context
Your environment
The text was updated successfully, but these errors were encountered: