Skip to content

bug(a11y): Focus styles not applying in Shadow DOM inside an element with *ngIf #19414

Closed
@jacobweber

Description

@jacobweber

Reproduction

https://stackblitz.com/edit/angular-e7d8vq

(or use my fork of the reproduction from #19133, with an *ngIf condition wrapped around the component)

I found #19133, which looks like it was fixed in 9.2.4. But I'm still seeing the issue when the components are inside an element with *ngIf.

Steps to reproduce:

  1. Create a component that uses ShadowDom
  2. Create some mat-buttons, inside an element with *ngIf
  3. Click one, and press tab
  4. The next button doesn't receive the tab focus style

Expected Behavior

Buttons and other elements should use tab focus style (background color).

Actual Behavior

Focus styles not applied. Removing the *ngIf condition around the buttons makes it work.

Environment

  • Angular: 9.2.4
  • CDK/Material: 9.2.4
  • Browser(s): Chrome latest
  • Operating System (e.g. Windows, macOS, Ubuntu): MacOS

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