Skip to content
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

fix(autocomplete): incorrectly detecting shadow DOM when inserted through an embedded view #19332

Merged

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented May 12, 2020

When an autocomplete is inserted, we try to figure out whether it's in the shadow DOM so that we can handle outside clicks properly. It seems like our logic can run too early in some cases, causing it to be detected incorrectly. These changes move the logic later in the process, right before the overlay is attached to the DOM.

Fixes #19330.

Note: In the first iteration I had a unit test for this, but I couldn't get it to pass on ViewEngine, because one of the APIs I used to query for an element in the shadow DOM wasn't working. Since we don't have a way of disabling tests for ViewEngine, I ended up reverting it.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels May 12, 2020
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 12, 2020
@crisbeto crisbeto force-pushed the 19330/autocomplete-shadow-dom-embedded-view branch from 1d4c28e to 2dcf795 Compare May 12, 2020 16:40
…ough an embedded view

When an autocomplete is inserted, we try to figure out whether it's in the shadow DOM so that we can handle outside clicks properly. It seems like our logic can run too early in some cases, causing it to be detected incorrectly. These changes move the logic later in the process, right before the overlay is attached to the DOM.

Fixes angular#19330.
@crisbeto crisbeto force-pushed the 19330/autocomplete-shadow-dom-embedded-view branch from 2dcf795 to d93406c Compare May 12, 2020 17:02
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 May 12, 2020
@mmalerba mmalerba merged commit 7769959 into angular:master May 15, 2020
mmalerba pushed a commit that referenced this pull request May 15, 2020
@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 Jun 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(mat-autocomplete): Using ngFor in matTab in combination with Shadowdom breaks mat-autocomplete
4 participants