-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query IFrames focusables #43
Conversation
Thank you so much for this contribution and especially for the amount of tests added. Please give me a time to process it |
The might be another way to handle the same problem, where "problem" is a mismatch of The main - tests and broken example - is here, the rest are details |
What other solution do you have in mind? Is it something we can do on the consumer side or a different implementation of the fix all together? |
So there are 3 cases:
You've tried to solve 3rd case using the terms of the first one, however it might be better be solved as a separate one, and might be checking |
Oh right that makes sense. Thanks! |
Just marking theKashey/react-focus-lock#218 as related to this change |
Merging into main branch continue development... |
I've spiked different implementations with However, it allowed me to optimize 🙇♂️ this PR was flawless from day 1. Thank you for your generous contribution. |
Thanks Anton! |
Currently
focus-lock
doesn't work as expected when the content of an iframe is dynamically updated.For example if content of the iframe is added using
ReactDOM.createPortal
the focus is stuck on the first focusable element: https://codesandbox.io/s/focus-lock-issue-with-dynamic-iframes-hfujkh?file=/src/App.tsx (Click on "Open in iframe" and then try tabbing to a different input. The focus is stuck on "enter your name")This PR handle iframes the same way it does with shadow nodes and has been heavily inspired by #33. It checks if the active element is an iframe and if it's the case look for tabbable element in the iframe document to prevent the focus to get stuck on the iframe element itself.