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(Tabs): Nested tabs with custom mat-tab-label template is wrongly applied to parent tab too #23558

Closed
bjdash opened this issue Sep 9, 2021 · 1 comment · Fixed by #23560
Assignees
Labels
area: material/tabs P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@bjdash
Copy link

bjdash commented Sep 9, 2021

Reproduction

Use StackBlitz to reproduce your issue:
https://stackblitz.com/edit/angular-ra4b9y?file=src/app/tab-group-custom-label-example.html

Steps to reproduce:

  1. Run the stackblitz example and notice the parent tab now has label of the first child tab instead of its own label

Expected Behavior

The parent tab-group is using the default <mat-tab label="Parent 1"> to set its label. The child tab-group is using <ng-template mat-tab-label>Child 1</ng-template> . The ideal behavior in this situation would be for the first tab of the parent group to have a label of Parent 1

Actual Behavior

The first tab of the parent group is wrongly taking the label of its child tab group

Environment

  • Angular: 12
  • CDK/Material: 12
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@bjdash bjdash added the needs triage This issue needs to be triaged by the team label Sep 9, 2021
@crisbeto crisbeto self-assigned this Sep 9, 2021
@crisbeto crisbeto added area: material/tabs 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 Sep 9, 2021
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 9, 2021
We use `ContenChild` to get a hold of the projected `mat-tab-label` inside a tab, but the problem is that this will also pick up label inside of nested tabs.

These changes add some safeguards so the labels don't get mixed up.

Fixes angular#23558.
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 9, 2021
We use `ContenChild` to get a hold of the projected `mat-tab-label` inside a tab, but the problem is that this will also pick up label inside of nested tabs.

These changes add some safeguards so the labels don't get mixed up.

Fixes angular#23558.
wagnermaciel pushed a commit that referenced this issue Sep 17, 2021
We use `ContenChild` to get a hold of the projected `mat-tab-label` inside a tab, but the problem is that this will also pick up label inside of nested tabs.

These changes add some safeguards so the labels don't get mixed up.

Fixes #23558.
wagnermaciel pushed a commit that referenced this issue Sep 17, 2021
We use `ContenChild` to get a hold of the projected `mat-tab-label` inside a tab, but the problem is that this will also pick up label inside of nested tabs.

These changes add some safeguards so the labels don't get mixed up.

Fixes #23558.

(cherry picked from commit 505c0d1)
@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 Oct 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/tabs P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants