-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Labels
Description
Issue Description
When using react-focus-lock, the focus navigation within a dialog breaks when a focusable component that displays the dialog is wrapped in a component with tabIndex="-1", and the component following it is also wrapped in a component with tabIndex="-1".
The focus navigation is not calculated correctly and gets stuck in a loop, returning to the starting component instead of cycling through all focusable elements.
Steps to Reproduce
- Open the CodeSandbox demo
- Click the "Open modal 1" button to open the dialog
- Press "Tab" twice or more
- Observe that the focus does not move and is stuck in a loop
Expected Behavior
Focus should move in a cycle through all focusable components within the dialog.
Environment
- react-focus-lock version: 2.13.5
- React version: (as specified in the CodeSandbox)