angular / angular/components

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

Abierto
#30,186 8 comentarios 10 reacciones 0 asignados Ver en GitHub
area: material/tabs area: theming P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la reproducción vinculada de StackBlitz y compara los tokens de tabs-overrides con las directivas backgroundColor y color. Traza cómo esas directivas afectan al estilo de tabs y, a continuación, verifica que background-color, foreground-color, active-label-text-color y active-indicator-color se apliquen sin ninguna de las dos directivas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
50/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.