Skip to content

fix(material/tabs): avoid not having any focusable tabs #31144

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

Merged
merged 2 commits into from
May 19, 2025

Conversation

crisbeto
Copy link
Member

In #26397 we made it possible to navigate to disabled tabs with the keyboard, however in the tabs nav bar they're still set to tabindex="-1" unless they're active. This means that if the nav bar only has disabled tabs, there's no way to enter it.

These changes make it so the tab index is based on the focus index which ensures that at least one tab is always focusable. It also aligns the behavior with mat-tab-group.

@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label May 19, 2025
@crisbeto crisbeto requested a review from a team as a code owner May 19, 2025 10:29
@crisbeto crisbeto requested review from adolgachev, mmalerba and andrewseguin and removed request for a team May 19, 2025 10:29
@crisbeto crisbeto added the G This is is related to a Google internal issue label May 19, 2025
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label May 19, 2025
crisbeto added 2 commits May 19, 2025 14:43
In angular#26397 we made it possible to navigate to disabled tabs with the keyboard, however in the tabs nav bar they're still set to `tabindex="-1"` unless they're active. This means that if the nav bar only has disabled tabs, there's no way to enter it.

These changes make it so the tab index is based on the focus index which ensures that at least one tab is always focusable. It also aligns the behavior with `mat-tab-group`.
@crisbeto crisbeto force-pushed the tab-link-tabindex branch from 1e826ff to ef0e2d0 Compare May 19, 2025 13:03
@crisbeto crisbeto merged commit 98065ce into angular:main May 19, 2025
20 of 22 checks passed
@crisbeto
Copy link
Member Author

The changes were merged into the following branches: main, 19.2.x, 20.0.x

crisbeto added a commit that referenced this pull request May 19, 2025
* fix(material/tabs): avoid not having any focusable tabs

In #26397 we made it possible to navigate to disabled tabs with the keyboard, however in the tabs nav bar they're still set to `tabindex="-1"` unless they're active. This means that if the nav bar only has disabled tabs, there's no way to enter it.

These changes make it so the tab index is based on the focus index which ensures that at least one tab is always focusable. It also aligns the behavior with `mat-tab-group`.

* fixup! fix(material/tabs): avoid not having any focusable tabs

(cherry picked from commit 98065ce)
crisbeto added a commit that referenced this pull request May 19, 2025
* fix(material/tabs): avoid not having any focusable tabs

In #26397 we made it possible to navigate to disabled tabs with the keyboard, however in the tabs nav bar they're still set to `tabindex="-1"` unless they're active. This means that if the nav bar only has disabled tabs, there's no way to enter it.

These changes make it so the tab index is based on the focus index which ensures that at least one tab is always focusable. It also aligns the behavior with `mat-tab-group`.

* fixup! fix(material/tabs): avoid not having any focusable tabs

(cherry picked from commit 98065ce)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: material/tabs G This is is related to a Google internal issue target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants