angular / angular/components

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

Open
#13,054 11 comments 9 reactions 1 assignee Claimed by @annieyw View on GitHub
Accessibility area: cdk/overlay area: material/dialog P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### 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](https://user-images.githubusercontent.com/5769929/45272711-36d7d580-b4f2-11e8-912a-b375f4694450.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.