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

bug(sidenav/drawer/focustrap): over/push mode do not remove tabindex="0" when drawer closed #29545

Closed
1 task done
krzysztofpiotrow opened this issue Aug 6, 2024 · 2 comments · Fixed by #29548
Closed
1 task done
Assignees
Labels
Accessibility This issue is related to accessibility (a11y) area: material/sidenav P2 The issue is important to a large percentage of users, with a workaround

Comments

@krzysztofpiotrow
Copy link

krzysztofpiotrow commented Aug 6, 2024

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

15

Description

When using mat-sidenav or mat-drawer with mode over or push (and might need backdrop=true) there is a div element:
<div class="cdk-visually-hidden cdk-focus-trap-anchor" aria-hidden="true"></div>
which always has tabindex="0" added to it but should get it only when the sidenav/drawer is opened.
As a result tabbing through the page is confusing.

Reproduction

StackBlitz link: https://stackblitz.com/edit/e4bsuu?file=package.json
StackBlitz was forked from the second example here: SideNav Examples
Steps to reproduce:

  1. Select Sidenav mode: Over, Has backdrop
  2. Via DevTools check that the mentioned elements have tabindex="0".

Expected Behavior

tabindex="0" is only added when the sidenav/drawer is opened.

Actual Behavior

tabindex="0" is always there and makes tabbing through the page confusing.

Environment

Angular: 16.1.1
CDK/Material: 16.2.0
Browser(s): Chrome
Operating System (e.g. Windows, macOS, Ubuntu): Windows

@krzysztofpiotrow krzysztofpiotrow added the needs triage This issue needs to be triaged by the team label Aug 6, 2024
@mmalerba mmalerba added P2 The issue is important to a large percentage of users, with a workaround Accessibility This issue is related to accessibility (a11y) area: material/sidenav and removed needs triage This issue needs to be triaged by the team labels Aug 6, 2024
@crisbeto crisbeto self-assigned this Aug 7, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 7, 2024
Completely disables the sidenav's focus trap while it's closed so users can't tab to the anchors.

Fixes angular#29545.
crisbeto added a commit that referenced this issue Aug 7, 2024
Completely disables the sidenav's focus trap while it's closed so users can't tab to the anchors.

Fixes #29545.
crisbeto added a commit that referenced this issue Aug 7, 2024
Completely disables the sidenav's focus trap while it's closed so users can't tab to the anchors.

Fixes #29545.

(cherry picked from commit 626164b)
@krzysztofpiotrow
Copy link
Author

Seems like this a duplicate: #27911

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) area: material/sidenav P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants