Dialog's focus lock prevents iframe from having focus
See original GitHub issueš Bug report
Imagine a focus-locked area of a web page (in this case a reach-ui dialog). Then we open an iframe thatās actually mounted outside of the focus-locked area, though visually it appears as a dialog itself (though this iframe is not using @reach/dialog
, the part that is focus-locked is what is really a @reach/dialog
in this example).
See codesandbox example linked to below.
Current Behavior
The focus-locked @reach/dialog
instance is too aggressive in keeping the focus for itself, preventing the iframe from having it.
Expected behavior
I understand the current behavior. But Iād like that @reach/dialog
would allow me to tell it otherwise.
Reproducible example
Try to type inside the Wikipedia search field that opens inside the iframe.
Suggested solution(s)
Maybe by exposing the whilelist prop of the react focus lock somehow.
Additional context
Related to #536. That one fixed the case where the focus-locked area is inside an iframe, and was preventing from accessing things outside the iframe. However, this case is when the focus locked area is outside the iframe, and prevents focus from being set to things inside an iframe.
Your environment
Software | Name(s) | Version |
---|---|---|
Reach Package | dialog | 0.10.3 |
React | 16.13.1 | |
Browser | Chrome, Firefox | latest |
Assistive tech | ||
Node | ||
npm/yarn | ||
Operating System |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top GitHub Comments
@chancestrickland I opened a PR. Iām sure itāll have some things to be improved or added (e.g. I did not add new tests or had to modify any, but I also did not see any tests about focus lock). Iām also not sure if the PR should be involved with documenting this in the website or elsewhere. I added a relatively acceptable documentation to the prop jsdoc, and the examples on how to use the new feature responsibly are in a new storybook example.
@gnapse The contribution is welcome!
Iād probably go with
dangerouslyBypassFocusLock
, set tofalse
by default. We definitely donāt want to encourage its use in the majority of cases. Iād like to add some documentation about why this is dangerous and should be avoided in most cases, and include an example showing how a custom focus lock can be added to the composed dialog. Happy to help with this if you run into any issues.