components icon indicating copy to clipboard operation
components copied to clipboard

bug(mat-tabs): Example of mat-tabs deletion is showing wrong index

Open parijat93sharma opened this issue 2 years ago • 1 comments

Is this a regression?

  • [ ] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

If we have three tabs and we navigate to the second tab or the 1st index and delete the first tab or the 0th index the selectedIndex doesnt update .

Reproduction

Steps to reproduce:

  1. Go to angular material website https://material.angular.io/components/tabs/examples, Under header 'Tab group with dynamically changing tabs'. Open Stackblitz.
  2. Remove the delete button html code from inside the mat-tab and place it outside the mat tab. Instead of passing index of mat-tab to remove function just pass 0 like (click)="removeTab(0)"
  3. Navigate to Tab1 or index =1 for mat tab and hit the delete button. The first mat tab gets deleted but the selectedIndex.value is still 1 in the screen.
  4. It only stops working when the currentIndex = 1 and we delete the 0th index Demo stackBlitz: https://components-issue-qwmzq3.stackblitz.io

Expected Behavior

The selectedIndex.value should show correct values

Actual Behavior

The selectedIndex.value shows incorrect value

Environment

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

parijat93sharma avatar Mar 21 '23 17:03 parijat93sharma

Hey anyone working on this #26816issue ?

DhirajSardar avatar Nov 09 '23 04:11 DhirajSardar

is this ticket still waits for the fix @parijat93sharma?

EnverUsta avatar May 01 '24 16:05 EnverUsta

I couldn't reproduce it, this may have been fixed by #28256

abonvalle avatar May 20 '24 16:05 abonvalle

Yes i am closing this issue. It has been fixed. Thanks

parijat93sharma avatar May 21 '24 05:05 parijat93sharma

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.