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

bug(mat-autocomplete): Using ngFor in matTab in combination with Shadowdom breaks mat-autocomplete #19330

Closed
marksuurland opened this issue May 12, 2020 · 1 comment · Fixed by #19332
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@marksuurland
Copy link

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-ivy-y21fh9

Steps to reproduce:

  1. Set encapsulation to ViewEncapsulation.ShadowDom of a component, in this case the root component, app.component.
  2. Create a mat-tab-group in the html of the component.
  3. Create property which contains the tabs, use a json like structure with several tabs, each tab containing a name and its options.
  4. Use ngFor to create several mat-tabs, use the tab name dynamically to set the label of the tab.
  5. Create an autocomplete component use the tab.options to set the options of the mat-autocomplete.
  6. Click on the autocomplete inside 1 of the tabs

Expected Behavior

What behavior were you expecting to see?
Mat autocomplete, opens its options dropdown.

Actual Behavior

What behavior did you actually see?
Mat autocomplete is closed immediately on click

Environment

  • Angular: 9.1.4
  • CDK/Material: 9.2.2 / 9.2.3
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@marksuurland marksuurland added the needs triage This issue needs to be triaged by the team label May 12, 2020
@crisbeto crisbeto self-assigned this May 12, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue May 12, 2020
…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 added has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels May 12, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue May 12, 2020
…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 added a commit to crisbeto/material2 that referenced this issue May 12, 2020
…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.
@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
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
2 participants