-
Notifications
You must be signed in to change notification settings - Fork 58
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
Tab Across Web Components #50
Comments
I agree with @scottfr, currently, even $(":tabbable") selector of jquery-ui doesn't support web components. So it would be great if we can add support for it (of course only in the case where "mode" is open). It would be interesting to find an approach to this problem. For me personally a solution can work, where I iterate over the DOM nodes and an API could tell me, whether that Node is tabbable or not. |
This library does now have |
Unfortunately current solution is not enough as Tabbable code doesn't deal with the concept of shadow dom at all. This is what needs to be solved as far as I can see: Query shadow roots
The problem is that as far as I know, there is no CSS selector to query elements that has a shadow root. That means that a search needs to iterate on every element to check for edit: we can also offer an option to specify custom element names to simplify the search (in case you know the element list in your application). Filter elements within shadow dom
other
No matter the solution, currently Tabbable is tested with jsdom and implementing this without testing in a real browser is problematic. |
The approach we followed was BFS traversal of the tree if there is a shadow root element. We used jQuery |
That is what I was suggesting, but I wouldn't run this by default for every tabbable/focusable call as not all users use shadow-dom (at list not in the current major version, maybe with a flag that can be flipped in the future).
That depends on the size and complexity of the DOM you have, the device your code is running on, and how frequent you run your checks. |
Yes we can give a flag. |
@LohitakshTrehan did you handle slotted elements in your implementation? |
No we didnt add any support for slotted elements at that time as we were not using them. Slotted elements are present out in the light-dom, so can be scanned easily even using jQuery |
https://stackoverflow.com/a/54119840 |
@idoros Thanks for the proposal/ideas. I like your idea of supporting a custom You clearly have more experience with the shadow DOM than I do. I'm trying my best to catch-up, but relying on your knowledge to implement something that will make sense. Slotted elements are a challenge, but what you're proposing sounds right. We could immediately start today by excluding from the order any elements we find to be tabbable if they have a |
FYI, |
It would be great if tabbable could identify the tab ordering between input fields across multiple web components.
Unfortunately since query selectors can't span shadow roots, it may require a very different approach.
The text was updated successfully, but these errors were encountered: