angular / angular/components

bug(tabs): customizable tokens background-color and foreground-color have no effect

オープン
#30,186 コメント 8 件 リアクション 10 件 担当者 0 名 GitHub で見る
area: material/tabs area: theming P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
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 trying to override tabs background and foreground colors
```typescript
@include mat.tabs-overrides(
(
background-color: red,
foreground-color: white,
)
);
```
nothing happens.

Overridden colors take effect only when apply `backgroundColor` directive on tabs component.

Moreover after applying `backgroundColor` directive customizable tokens `active-label-text-color` and `active-indicator-color` aren't being applied anymore.
```typescript
@include mat.tabs-overrides(
(
background-color: red,
foreground-color: white,
active-label-text-color: green,
active-indicator-color: green,
)
);
```
In this case using directive `color` on tabs component solve the problem.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/2xvcvpsg
Steps to reproduce:
It's self-explanatory

### Expected Behavior

Customizable tokens should apply regardless directives `backgroundColor` and `color`

### Actual Behavior

Customizable tokens are applied only when directives `backgroundColor` and `color` are used on tab component.

### Environment

Angular CLI: 19.0.4
Node: 22.11.0
Package Manager: pnpm 9.13.2
OS: linux x64

Angular: 19.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1900.4 (cli-only)
@angular-devkit/build-angular 19.0.4
@angular-devkit/core 19.0.4
@angular-devkit/schematics 19.0.4
@angular/cdk 19.0.2
@angular/cli 19.0.4
@angular/material 19.0.2
@angular/material-luxon-adapter 19.0.2
@angular/ssr 19.0.4
@schematics/angular 19.0.4
rxjs 7.8.1
typescript 5.6.3
webpack 5.97.1
zone.js 0.15.0

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされた StackBlitz の再現から始め、tabs-overrides トークンと backgroundColor および color ディレクティブを比較します。これらのディレクティブが tabs のスタイルにどのような影響を与えるかを追跡し、その後、background-color、foreground-color、active-label-text-color、active-indicator-color がどちらのディレクティブも指定しなくてもすべて適用されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
50/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。