Description
Bug, feature request, or proposal:
Bug?
What is the expected behavior?
Adding or removing tabs shouldn't change which tab is selected
What is the current behavior?
Adding or removing tabs causes selection to change
What are the steps to reproduce?
Go to this plunker, and select one of the later tabs (5 or 6). Click the "Toggle" button at the top, and watch which tab is selected.
What is the use-case or motivation for changing an existing behavior?
The user didn't click on a different tab, so they don't expect the selected tab to change.
I believe the selected tab is based on an index / offset into the tab collection, so when *ngIf
goes false, the collection shrinks and the same offset now points to a different tab. This might mean that you can't use *ngIf
to hide tabs, which would mean that a) this needs to be documented, and b) an alternative property should be provided to signify "don't show this tab, but keep it in the collection so that its size doesn't change and mess up the selection offset". It would be nice if selection was instead based on a generated ID for each tab, but that might not be practical.