Skip to content

bug(MatDialog): with 'autoFocus: false' lacks focus trap after angular/material@9.2.1/9.2.2 #19246

Closed
@trebor292

Description

@trebor292

Reproduction

Steps to reproduce:

  1. Add autoFocus: false to any matDialog stackblitz example with a tabbable element.
  2. Tab through and see focus goes beyond the dialog

Expected Behavior

Expected behavior can be seen with the use of @angular/material@9.2.0. The focus trap div is correctly added and tabbing with the dialog open, keeps the focus inside the dialog. Automatically added focus trap div:
<div tabindex="0" class="cdk-visually-hidden cdk-focus-trap-anchor" aria-hidden="true"></div>

Actual Behavior

The div above is nowhere to be seen with angular/material@9.2.1 or 9.2.2, and consevently lets focus move beyond and outside the dialog.

Environment

  • Angular/Material: 9.2.1
  • Browser(s): Chrome, IE, Edge (any)
  • Operating System: Windows

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions