Multiple modals and returnFocus
See original GitHub issueFocus is not returned with multiple <FocusLock>s.
Sample CRA project: https://github.com/andraaspar/react-focus-lock-stack-missing
To reproduce:
- Click ‘Open modal 1’
- On the modal, click ‘Open modal 2’
- On the 2nd modal, click ‘X2’ → Focus is set to ‘Open modal 2’ instead of ‘X1’
- On the modal, click ‘X1’ → Focus is not returned to ‘Open modal 1’
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Multiple modals | Yale Grammatical Diversity Project
Multiple modals are instances of more than one modal occurring in a single sentence. (Modals are words like can, might, and should that...
Read more >Creating An Accessible Modal Dialog - bitsofcode
Modal Dialogs are a tricky thing to make accessible. ... Set Focus; On Dialog Close, Return Focus to the Last Focused Element; While...
Read more >Modal | Components - BootstrapVue
<b-modal> provides several accessibility features, including auto focus, return focus, keyboard (tab) focus containment, and automated aria-* attributes. Note: ...
Read more >Modal | Components | BootstrapVue
Accessibility. <b-modal> provides several accessibility features, including auto focus, return focus, and keyboard (tab) focus containment.
Read more >T87714 Return focus to the last location when a modal dialog is ...
Return focus to the last location when a modal dialog is dismissed. Closed, ResolvedPublic. Actions · Description · Details · Related Objects. Search......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Sure. This might also resolve another issue with a too-fast move focus inside - https://github.com/theKashey/react-focus-on/issues/36
It’s not super easy to solve it with the current tools provided with focus-lock, so maybe it would be a good idea to somehow have it trigger on an event, or after a timeout as you suggest.