Focus trap does not respect tabindex
See original GitHub issueBug, feature request, or proposal:
Bug.
What is the expected behavior?
Focus trap will focus elements with respect to tabindex attribute.
What is the current behavior?
When a dialog body (or any other focus trap) contains a HTML like this:
<input type="text" tabindex=2 ...>
<button tabindex=1 ...>
the input
is focused, but the button
should be obviously.
In addition using higher tabindex then 0 causes the focus trap to stop working at all. The anchors have tabindex 0 and are focused after all other elements on the page with tabindex not set. User is therfore able to focus elements under dialog overlay.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
@angular 4.2.4 @angular/material 2.0.0-beta.7
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Focus trap does not respect tabindex · Issue #5435 - GitHub
Focus trap will focus elements with respect to tabindex attribute. What is the current behavior? When a dialog body (or any other focus ......
Read more >Using tabindex - web.dev
In instances like this you can implement a temporary keyboard trap to ensure that you trap focus only while the modal is displayed...
Read more >Browser is not respecting tabindex setting - Stack Overflow
I have added tabindex="1" to the link which you can see here, but the browser doesn't seem to respect it at all (tested...
Read more >Focus Trapping for Accessibility (A11Y) | by Rahul Kumar
In this article, I will cover one of the important aspects of making a web-page accessible — trapping/looping (will call it looping from ......
Read more >Avoid positive tabindex values
... tabindex="0" if an interactive element doesn't naturally receive focus ... is usable with single pointer inputs · Ensure there are no keyboard...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any news on this? It’s quite problematic that focus trap stops working once a tabIndex is set inside a dialog 😕
For someone just want set the initial focused element but don’t require detail orders. Use cdkFocusInitial directive on the element you want it to focus on first.