angular / angular/components

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

オープン
#24,370 コメント 14 件 リアクション 6 件 担当者 0 名 GitHub で見る
area: material/core area: theming docs 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

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

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

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

調査の方向性

まず issue の Angular 13.1.2 のケースを再現し、mat.all-component-themes($my-theme) と mat.all-component-typographies($my-typography) を比較します。mat.core-theme() と all-component-themes() が使用するタイポグラフィ mixin を追跡します。設定した Arial フォントが Material コンポーネントだけでなく、body と標準のタイポグラフィレベルにも適用されれば完了です。

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

評価

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

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

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