-
Notifications
You must be signed in to change notification settings - Fork 70
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
Autofocus keeps firing inside shadow dom #188
Comments
well, I know what's happening and even why. The only real problem - in the past there were some complications around creating a comprehensive unit test for shadow dom. |
@theKashey this issue affects me as well, and kinda in a big way. Is there anything I can do to help you here? |
The best one can do - create a failing test. Then it will be easier to "understand" the problem and "know" when it's fixed. |
@theKashey It's not related to autofocus attribute. Focus-lock is not working with shadow-dom, because document.activeElement returns root element of shadow dom. In order to get actual active element you need to check if an element have shadowRoot attribute: |
Thanks @pavelsherm - now I am one step closer to understanding the problem (as I am not any shadow-dom/web-components expert or even user) |
Here is a test that reliably fails on the current version. If you remove the use of FocusLock component, the test passes. I had to update the version of jsdom this project is using, because currently installed version of the library does not support shadow DOM yet
|
The test provided by @Jaodi has been added as a base specification for shadow-dom and Necessary updates were released as a part of v I cannot verify the correctness of this implementation as I don't have a real usecase. |
This issue has been marked as "stale" because there has been no activity for 2 months. If you have any new information or would like to continue the discussion, please feel free to do so. If this issue got buried among other tasks, maybe this message will reignite the conversation. Otherwise, this issue will be closed in 7 days. Thank you for your contributions so far. |
A problem occurs when a focus lock component with
autoFocus
is rendered inside a shadow root. Component successfully focuses first interactive element, but then repeatedly resets focus to it, when a user tries to focus anything else.Here is the code of the demo reproducing the issue:
The text was updated successfully, but these errors were encountered: