Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icons are not rendered correctly from icon sets with svg sprites #16958

Closed
hodossy opened this issue Sep 3, 2019 · 2 comments
Closed

Icons are not rendered correctly from icon sets with svg sprites #16958

hodossy opened this issue Sep 3, 2019 · 2 comments

Comments

@hodossy
Copy link

hodossy commented Sep 3, 2019

Reproduction

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

Steps to reproduce:

  1. Create an SVG sprite with symbol element with viewBox
  2. Register the icon set with MatIconRegistry
  3. Use the icon with mat-icon and svgIcon

For me the stackblitz link is not working, but if you download the project, then you can check the issue with npm install & ng serve.

Expected Behavior

SVG correctly rendered.

Actual Behavior

The SVG element is correctly placed inside the DOM, but the icon is not visible.

Probable root cause

If the viewbox is large enough, only the top left 24x24 pixels are shown on the screen. This is because the viewBox attribute is not copied from the symbol element. Manually adding it to the svg element in DevTools fixes the error.

Environment

  • Angular: 8.2.4
  • CDK/Material: 8.1.4
  • Browser(s): Chrome Version 76.0.3809.132
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 (Version 1809 Build 17763.678)
@crisbeto
Copy link
Member

crisbeto commented Sep 3, 2019

#16896 will fix the viewBox not being added.

@crisbeto crisbeto closed this as completed Sep 3, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants