angular / angular/components

bug(TABS): tabs with fitInkBarToContent does not follow Material 3 design specs

未关闭
#30,375 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: material/tabs P2
主要语言
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

As per [Material 3 guidelines](https://m3.material.io/components/tabs/specs), primary tabs should have active indicator's height of `3px` and shape of `3px 3px 0 0`. In Angular Material, primary tabs' behaviour can be achieved using `[fitInkBarToContent]=true` input.

But, they have height of `2px`, and shape of `0`, which is right only for secondary tabs.

We can override it by using `tabs-overrides` mixin like below:

```scss
@use '@angular/material' as mat;

[fitInkBarToContent],
[ng-reflect-fit-ink-bar-to-content='true'] {
> .mat-mdc-tab-header {
@include mat.tabs-overrides(
(
active-indicator-shape: 3px 3px 0 0,
active-indicator-height: 3px,
)
);
}
}
```

But, it should be the default behaviour as per Material 3 specs.

### Reproduction

Not needed.

### Expected Behavior

Tabs with `[fitInkBarToContent]=true` should have active indicator's height of `3px` and shape of `3px 3px 0 0`.

### Actual Behavior

Tabs with `[fitInkBarToContent]=true` have active indicator's height of `2px`, and shape of `0`.

### Environment

- Angular: 19
- CDK/Material: 19
- Browser(s): Edge
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

贡献指南

打开贡献指南

调研方向

从 Angular Material 的 tabs 实现和 tabs-overrides mixin 开始,跟踪 fitInkBarToContent 路径以及 .mat-mdc-tab-header 上的 active-indicator 样式。完成的标准是此输入会生成一个 3px 的 active indicator,其形状为 3px 3px 0 0,并符合所述的 Material 3 预期。

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

评估

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

把新 issue 发到你的邮箱

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