-
Notifications
You must be signed in to change notification settings - Fork 959
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
negative tabindex not working as expected #2917
Comments
Looking into the code, it appears that this is the problem line (el.tabIndex > 0 || (!interactiveOnly && el.tabIndex === 0 && el.getAttribute("tabindex") !== null && el.getAttribute("aria-hidden") !== "true"))
!interactiveOnly && el.hasAttribute("tabindex") && el.getAttribute("aria-hidden") !== "true") The original implementation seems to be conflating an element being focusable with an element being accessible via keyboard navigation which is not the same thing. Additionally, it seems to be treating positive tabindexes as interactive which I believe is a separate bug. Here's an excerpt from MDN explaining the meaning of different tabindex values:
|
Environment
Actual behavior
If you try to use JS.focus to move focus to a non-interactive element with tabindex of -1 it does not move focus to said element. However, if you give the element a tabindex >= 0 it will move focus to the element when JS.focus is called.
Expected behavior
JS.focus should move focus to any element with a tabindex that is negative since a negative tabindex indicates an element which should not be tabbable, but is still programmatically focusable.
The text was updated successfully, but these errors were encountered: