angular / angular/components

bug(typography): h4 not using subtitle-2 as described in the docs

Abierto
#26,351 2 comentarios 5 reacciones 0 asignados Ver en GitHub
area: theming P2
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

[Here](https://material.angular.io/guide/typography#typography-levels) the documentation states that `subtitle-2` is corresponding to the `

`. I found that the ` tag is actually using the `body-1` styling as you can see in the following code snipped copied from the `_typography.scss` file.
```css
.mat-h4,
.mat-body-1,
#{$selector} .mat-h4,
#{$selector} .mat-body-1,
#{$selector} h4 {
@include typography-utils.typography-level($config, body-1);
margin: 0 0 16px;
}
```

and subtitle-2 is not corresponding to any heading:

```css
.mat-body-strong,
.mat-subtitle-2,
#{$selector} .mat-body-strong,
#{$selector} .mat-subtitle-2 {
@include typography-utils.typography-level($config, subtitle-2);
}
```

### Reproduction

* Define a custom typography config with `mat.define-typography-config`
* Define `$subtitle-2`
* Use a `

` tag in your template (with or without explicitly defining the class `mat-h4` on the element)
* Style of `subtitle-2` is not applied to the `

` tag.

### Expected Behavior

`

` tags should either use `subtitle-2` or the documentation should be updated

### Actual Behavior

`

` is using `body-1` styling

### Environment

- Angular: 15.0.3
- CDK/Material: 15.0.3
- Browser(s): Chromium based (Brave, Chrome)
- Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la documentación de typography-levels enlazada y las reglas _typography.scss referenciadas. Reproduce el problema con un mat.define-typography-config personalizado y un elemento h4, y determina después si debe cambiar la asignación documentada de subtitle-2 o el comportamiento de SCSS. Se considera terminado cuando el estilo de h4 y la documentación coinciden.

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

Evaluación

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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.