Skip to content
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

<slot> element with tabindex="-1" causes slotted elements that are usually focusable to not be focusable. #9971

Open
KonnorRogers opened this issue Dec 1, 2023 · 0 comments
Labels
topic: focus topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@KonnorRogers
Copy link

KonnorRogers commented Dec 1, 2023

What is the issue with the HTML Standard?

When creating a Web Component and using a <slot> element in the shadow DOM, if you use a <slot tabindex="-1"> any focusable slotted elements will no longer be focusable.

This can be observed in all 3 browsers here:

https://codepen.io/paramagicdev/pen/mdvzgQY

Tested with the following browsers:

Chrome: 119
Firefox: 120
Safari: 16.4

OS: MacOS Venture 13.3

I'm not sure if this is a gap in the spec, expected behavior, or a "bug".

I stumbled on it today and I was recommended to report it here by @keithamus

Additional notes

This feels unintended because parents with a tabindex should not affect their children, unlike inert.

Note that applying tabindex="-1" to an element doesn't affect its children;

https://web.dev/articles/control-focus-with-tabindex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: focus topic: shadow Relates to shadow trees (as defined in DOM)
Development

No branches or pull requests

2 participants