Skip to content

fix: focus monitor-based styles not working in some cases inside shadow dom #19422

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

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

crisbeto
Copy link
Member

A while ago event delegation was implemented for the focus monitor which has some special behavior where it has to bind its events to the closest shadow root in order for them to work correctly. The problem is that a lot of our FocusMonitor.focus calls are very early in the component lifecycle which means that might not have been put into the shadow DOM yet. These changes move the monitor calls to ngAfterViewInit to resolve the issue.

Fixes #19414.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround Accessibility This issue is related to accessibility (a11y) target: patch This PR is targeted for the next patch release labels May 22, 2020
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 22, 2020
@crisbeto crisbeto force-pushed the 19414/focus-monitor-calls branch from 059f087 to 30f6912 Compare May 22, 2020 14:28
…ow dom

A while ago event delegation was implemented for the focus monitor which has some special behavior where it has to bind its events to the closest shadow root in order for them to work correctly. The problem is that a lot of our `FocusMonitor.focus` calls are very early in the component lifecycle which means that might not have been put into the shadow DOM yet. These changes move the `monitor` calls to `ngAfterViewInit` to resolve the issue.

Fixes angular#19414.
@crisbeto crisbeto force-pushed the 19414/focus-monitor-calls branch from 30f6912 to bbfd25b Compare June 9, 2020 15:26
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added lgtm action: merge The PR is ready for merge by the caretaker labels Jun 9, 2020
@andrewseguin andrewseguin added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Jun 10, 2020
@andrewseguin andrewseguin merged commit df981ee into angular:master Jun 10, 2020
@ray-kay
Copy link

ray-kay commented Jun 16, 2020

Good progress on this one. I see its merged to master.
When will it be released in 9.2.x? Our client (public infrastructure) is waiting to get the product a11y certified :)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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