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(bottom-sheet): auto focus defaults to dialog instead of first-tabbable #30483

Open
1 task
mlemoine-clgx opened this issue Feb 12, 2025 · 0 comments
Open
1 task
Labels
area: material/bottom-sheet P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@mlemoine-clgx
Copy link

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

No response

Description

The documentation https://material.angular.io/components/bottom-sheet/overview#focus-management specifies that the default behavior for autoFocus is first-tabbable. However, since at least v16, the default behavior has been set to dialog.

This is a surprising autoFocus behavior from an accessibility standpoint.

This even seems to have been enshrined in the tests: https://github.com/angular/components/blob/c1ff40f/src/material/bottom-sheet/bottom-sheet.spec.ts#L620

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-dd7tdtv9?file=src%2Fmain.ts
Steps to reproduce:

  1. BottomSheet opens on init
  2. Note that the element inside does not have focus. But it is tabbable

Expected Behavior

First tabbable element should receive focus

Actual Behavior

First tabbable element does not receive focus, bottom sheet container receives focus instead.

Environment

  • Angular: 18.2.8
  • CDK/Material: 18.2.8
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@mlemoine-clgx mlemoine-clgx added the needs triage This issue needs to be triaged by the team label Feb 12, 2025
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/bottom-sheet and removed needs triage This issue needs to be triaged by the team labels Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/bottom-sheet P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

2 participants