angular / angular/components

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

オープン
#26,351 コメント 2 件 リアクション 5 件 担当者 0 名 GitHub で見る
area: theming P2
主要言語
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

[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

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

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

調査の方向性

リンク先の typography-levels ガイドのドキュメントと、参照されている _typography.scss のルールから始めます。カスタムの mat.define-typography-config と h4 要素を使って問題を再現し、その後、文書化されている subtitle-2 のマッピングと SCSS の動作のどちらを変更すべきかを判断します。h4 のスタイルとドキュメントが一致すれば完了です。

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

評価

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

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

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