[Bug]: Uncaught RangeError: Maximum call stack size exceeded. focusElement of Modal
See original GitHub issueWhat package within Headless UI are you using?
What version of that package are you using?
1.4.1
What browser are you using?
chrome
Reproduction repository
Not now.
Describe your issue
while we create Modal
multiple (2+) it will throw me
focus-management.esm.js?d1e3:99 Uncaught RangeError: Maximum call stack size exceeded.
at focusElement (focus-management.esm.js?d1e3:99)
at eval (use-focus-trap.esm.js?25af:110)
at handler (use-window-event.esm.js?b5e3:8)
at focusElement (focus-management.esm.js?d1e3:99)
at eval (use-focus-trap.esm.js?25af:110)
at handler (use-window-event.esm.js?b5e3:8)
at focusElement (focus-management.esm.js?d1e3:99)
at eval (use-focus-trap.esm.js?25af:110)
at handler (use-window-event.esm.js?b5e3:8)
at focusElement (focus-management.esm.js?d1e3:99)
at eval (use-focus-trap.esm.js?25af:110)
at handler (use-window-event.esm.js?b5e3:8)
at focusElement (focus-management.esm.js?d1e3:99)
at eval (use-focus-trap.esm.js?25af:110)
at handler (use-window-event.esm.js?b5e3:8)
at focusElement (focus-management.esm.js?d1e3:99)
at eval (use-focus-trap.esm.js?25af:110)
at handler (use-window-event.esm.js?b5e3:8)
at focusElement (focus-management.esm.js?d1e3:99)
at eval (use-focus-trap.esm.js?25af:110)
BTW, can Modal
need to provider flag props to disabled focusElement
feature, in most case we don’t need this, i think.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:33
Top Results From Across the Web
Uncaught RangeError: Maximum call stack size exceeded
You've got two infinite loops between two "modals" both demanding focus. The Dialog and the Select popover components are fighting for focus.
Read more >Dialog (Modal) - Headless UI
A fully-managed, renderless dialog component jam-packed with accessibility and keyboard features, perfect for building completely custom modal and dialog ...
Read more >JR63247: AN INFINITE LOOP OCCURS IN THE JAVASCRIPT ...
Under certain circumstances, using Modal Section controls in a coach can lead to ... Uncaught RangeError: Maximum call stack size exceeded. at subclass....
Read more >JavaScript RangeError: Maximum Call Stack Size Exceeded
The JavaScript RangeError: Maximum call stack size exceeded is an error that occurs when there are too many function calls, or if a...
Read more >InternalError: too much recursion - JavaScript - MDN Web Docs
RangeError : Maximum call stack size exceeded (Chrome) InternalError: too much ... or a function is missing a base case, JavaScript will throw...
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
Hey! Thank you for your bug report! Much appreciated! 🙏
For everyone finding this issue.
The problem: You want 2 Dialogs, but it won’t work Solution: Dialogs must be nested if you want multiple Dialogs. Dialogs can’t be siblings because if you happen to open them at the same time each Dialog will try to steal focus again because a Dialog should be considered a separate page where you can’t interact with the content behind it.
We’re having this issue too, it’s a pretty common use case to have sibling modals, other libs like Baseweb handle this fine or at least provide a way to turn off autofocus
is there a way to do that with HeadlessUI, and if not would you be open to a PR allowing for autofocus to be turned off ?