angular / angular/components

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

オープン
#26,261 コメント 2 件 リアクション 4 件 担当者 0 名 GitHub で見る
area: material/toolbar good first issue P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされた StackBlitz の再現例から始め、mat-toolbar によって適用されるスタイルと、body 上の mat-typography クラスによるスタイルを比較します。h1、h2、および同様の要素に対するツールバーのタイポグラフィスタイルを追跡します。完了とは、margin が 0 であることや期待されるフォントサイズを含め、それらの意図されたツールバースタイルが優先されることを意味します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。