Skip to content

Controls below the angular material dialog overlay still can be focused by keyboard #13054

@new-mikha

Description

@new-mikha

Bug, feature request, or proposal:

Bug

What is the expected behavior?

The dialog should be completely modal.

What is the current behavior?

Controls that are below in z-order of the Angular Material dialog overlay still can be focused by keyboard.

What are the steps to reproduce?

  • Go to the stock Angular Material Dialog example: https://material.angular.io/components/dialog/examples
  • Close the Dev Tools if it been opened earlier (this will just allow less TABs to press later, see below)
  • Click on the Pick One button, the dialog pops up
  • Click the browser address tab (Chrome on Windows been used for test)
  • Start pressing TAB on the keyboard - you will notice that controls underneath the dialog overlay are getting selected, with all keyboard interaction enabled for the selected control. E.g. it's possible to enter new values into text boxes, press buttons etc.

Out of curiosity I also checked Bootstrap Modal - it also got similar problem, but for that one Shift-TAB needs to be pressed to reproduce.

As a suggestion - I understand that the dialog overlay is currently based on cdkTrapFocus directive. This one is suffering from the same problem, I presume it's exactly same problem, so it would be nice to fix it on the level of cdkTrapFocus - because the focus trap is quite useful thing.

image

Metadata

Metadata

Assignees

Labels

AccessibilityThis issue is related to accessibility (a11y)P4A relatively minor issue that is not relevant to core functionsarea: cdk/overlayarea: material/dialog

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions