angular / angular/components

MatIcon `inline` doesn't work with `svgIcon`

Offen
#16,483 3 Kommentare 11 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/icon P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

#### Reproduction

https://stackblitz.com/edit/angular-s9aswa

#### Expected Behavior

Loading an icon via SVG and displaying it `inline` should make its size proportionate to the text.

#### Actual Behavior

The size of the icon did not change and the icon's position broke.

I think it has to do with how the SVG has `width: 100%; height: 100%` applied to it:

https://github.com/angular/components/blob/738f10c9931642469f3699d4c8ff50b1e66a960e/src/material/icon/icon-registry.ts#L525

Maybe it could change to `1em` for `inline` icons?

Alternatively if `inline` is not supported for `svgIcon` then it should be documented.

Note: I had to inline the SVG as base64 because the original StackBlitz is broken - I will open another issue for this.

#### Environment

- Angular: Docs Stackblitz (8.1.0)
- CDK/Material: Docs Stackblitz (8.0.2)
- Browser(s): Chrome 75
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the linked StackBlitz reproduction, then inspect src/material/icon/icon-registry.ts around line 525, where SVG sizing is applied. Confirm how inline SVG icons behave with svgIcon and establish whether the final result should make the icon proportionate to surrounding text or document that combination as unsupported.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.