phoenix_live_view
phoenix_live_view copied to clipboard
A11y `JS.push_focus` and `JS.pop_focus` do not work as expected with nested modals
I'm working on an app that has a modal rendered over another modal as well as a modal rendered over a side drawer.
Expected behavior
I would expect JS.push_focus
and JS.pop_focus
to act like push and pop operations in a stack in order to work correctly when opening one modal over another modal.
Actual behavior
The focusStack
variable where the focused element is stored is not a stack but rather just a single element.
https://github.com/phoenixframework/phoenix_live_view/blob/37bcbc4515efbedd3e85b3c0fbd39c4f88cea9f7/assets/js/phoenix_live_view/js.js#L98-L107