angular / angular/components

bug(mat-toolbar): mat-toolbar styles for elements like h1, h2, ... are not taking precedence over mat-typography

Ouverte
#26,261 2 commentaires 4 réactions 0 personnes assignées Voir sur GitHub
area: material/toolbar good first issue P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

### 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 a header tag is used within mat-toolbar the stylings from the theme do not take precedence.
The default styles from mat-typography are still used. Therefore the margin is not reset to 0 and the font-size also differs.

![image](https://user-images.githubusercontent.com/5477981/207587289-b7ba6a95-9ae1-49f6-bfc7-3585a74cd285.png)

### Reproduction

https://stackblitz.com/edit/components-issue-t1dkvg

Steps to reproduce:
1. Apply mat-typography class to body
2. Add h1 tag with text to mat-toolbar

### Expected Behavior

Specific styles from mat-toolbar for these elements should take precedence. e.g. margin should be 0.

### Actual Behavior

Default mat-typography styles are used even though mat-toolbar would specify more accurate ones.

### Environment

- Angular: 15.0.2
- CDK/Material: 15.0.2
- Browser(s): Edge
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction StackBlitz liée et comparez les styles appliqués par mat-toolbar à ceux de la classe mat-typography sur le body. Suivez les styles typographiques de la toolbar pour h1, h2 et les éléments similaires ; c'est terminé lorsque leurs styles de toolbar prévus prennent le dessus, notamment avec un margin nul et la taille de police attendue.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
52/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.