angular / angular/components

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

Aperta
#26,351 2 commenti 5 reazioni 0 assegnatari Vedi su GitHub
area: theming P2
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dalla documentazione typography-levels collegata e dalle regole _typography.scss a cui si fa riferimento. Riproduci il problema con un mat.define-typography-config personalizzato e un elemento h4, quindi determina se debba cambiare la mappatura documentata di subtitle-2 o il comportamento SCSS. Il lavoro è completato quando lo stile di h4 e la documentazione concordano.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, scss
Ambito
design, frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.