angular / angular/components

bug(Theming Angular Material): Custom typography not applied to standard typography levels in mat.core-theme() or all-component-themes()

Aperta
#24,370 14 commenti 6 reazioni 0 assegnatari Vedi su GitHub
area: material/core area: theming docs P3
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

Tried to change the font-family so that e.g. body-1 everywhere has font family Arial.
But it only changed the font-family in mat components, not outside in normal divs.

```
$my-typography: mat.define-typography-config(
$font-family: 'Arial',
);
$my-theme: mat.define-light-theme((
typography: $my-typography,
color: (
primary: $dicey-primary,
accent: $dicey-accent,
warn: $dicey-warn,
))
);
@include mat.all-component-themes($my-theme);
```

Similar problem was reported here, but not solved: https://github.com/angular/components/issues/23683#issue-1015421891

-----------------------

It works when I do it with all-component-typographies:

```
$my-typography: mat.define-typography-config(
$font-family: 'Arial',
);
@include mat.all-component-typographies($my-typography);
```

### Reproduction

Steps to reproduce:
1. Add custom theme with typography
2. See if body tag font-family changes

### Expected Behavior

Bodys font family changes to custom font family

### Actual Behavior

The body font family is standard Roboto

### Environment

- Angular: 13.1.2
- CDK/Material: 13.1.1
- Browser(s): Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo il caso Angular 13.1.2 riportato nell’issue, confrontando mat.all-component-themes($my-theme) con mat.all-component-typographies($my-typography). Traccia i mixin di tipografia utilizzati da mat.core-theme() e all-component-themes(); il lavoro è completato quando il carattere Arial configurato viene applicato al body e ai livelli di tipografia standard, non solo ai componenti Material.

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

Valutazione

Stack tecnologico
angular, sass, typescript
Ambito
design, frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 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.