angular / angular/components

bug(mat-tab): tab group dynamic does not allow to select first tab if newly created

未关闭
#24,445 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: material/tabs P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### 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

When i add a new tab dynamically from a button, if i choose to set the new tab as first item in the tab list and want it to select this tab, it does nothing.
I have to first select a new tab and then repeat it to make it works.

### Reproduction

https://stackblitz.com/edit/angular-qhbfy8?file=app/tab-group-dynamic-example.ts
Steps to reproduce:
1. Select checkbox : "Select tab after adding"
2. Click btn "Add new tab"

### Expected Behavior

It should select first tab

### Actual Behavior

it does not change the current tab

### Environment

- Angular: 13
- CDK/Material: 13
- Browser(s): Chrome

贡献指南

打开贡献指南

调研方向

使用链接的 StackBlitz 重现问题,从 app/tab-group-dynamic-example.ts 以及在开头插入选项卡的步骤开始。跟踪动态 mat-tab group 如何处理新插入的第一个选项卡的选择。完成的标准是:选中复选框并点击“Add new tab”后,立即选中第一个选项卡。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。