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

Rendering Issue with Adjusted viewBox SVGs in astro-icon v1.1.0 #212

Open
tetracalibers opened this issue Mar 8, 2024 · 0 comments
Open

Comments

@tetracalibers
Copy link

tetracalibers commented Mar 8, 2024

What version of astro-icon are you using?

v1.1.0

Astro Info

Astro                    v4.4.14
Node                     v20.4.0
System                   macOS (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             astro-icon

If this issue only occurs in one browser, which browser is a problem?

Chrome, Safari, Firefox

Describe the Bug

SVG icons adjusted with tools like SVG Crop are partially missing when rendered using astro-icon v1.1.0.

スクリーンショット 2024-03-08 8 57 40

The following situations do not cause problems:

What's the expected result?

Removing the viewBox from svg elements and assigning it to the symbol element resolves the issue:

<!-- Removed viewBox from svg element -->
<svg width="100" height="100" data-icon="astro-cropped">
  <!-- Instead, a viewBox is specified for the symbol element -->
  <symbol id="ai:local:astro-cropped" viewBox="4.93 2 22.15 28">
    <!-- ... -->
  </symbol>
  <use xlink:href="#ai:local:astro-cropped"></use>
</svg>

<!-- Removed viewBox from svg element -->
<svg width="100" height="100" data-icon="astro-cropped">
  <use xlink:href="#ai:local:astro-cropped"></use>
</svg>

Link to Minimal Reproducible Example

https://github.com/tetracalibers/astro-icon-symbol-viewbox-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant