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

fix: show icon with gradients in Chrome #56

Merged
merged 2 commits into from
Oct 20, 2022
Merged

Conversation

dwightjack
Copy link
Contributor

@dwightjack dwightjack commented Oct 4, 2022

I noticed that some icons (like logos:vitejs) are not showing in Chrome, but they work fine in Firefox.

After some investigation, it seems that using display: none on the spritesheet's SVG causes gradients to don't work in Chrome. Resources:

I also created a demo in CodePen to reproduce the issue (screenshot below):

image

This PR uses another technique to hide the spritesheet that should make everything work in Chrome.

For reference, here are my system's details:


  System:
    OS: macOS 12.5.1
  Binaries:
    Node: 16.17.0 
    Yarn: 1.22.4 
    npm: 8.15.0 
  Browsers:
    Chrome: 105.0.5195.125
    Firefox: 105.0.1
    Safari: 15.6.1
  npmPackages:
    astro-icon: 0.7.3 => 0.7.3

@changeset-bot
Copy link

changeset-bot bot commented Oct 4, 2022

🦋 Changeset detected

Latest commit: 4805671

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
astro-icon Patch
www Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 4, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
api-astroicon ✅ Ready (Inspect) Visit Preview Oct 4, 2022 at 7:50AM (UTC)
astroicon ✅ Ready (Inspect) Visit Preview Oct 4, 2022 at 7:50AM (UTC)

@dwightjack
Copy link
Contributor Author

By the way, At the moment a quick fix could be adding the following CSS where the <Sprite.Provider /> component is used:

:global([astro-icon-spritesheet]) {
  display: block !important;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

Copy link
Collaborator

@stramel stramel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for the PR!

@stramel stramel merged commit 60c7304 into natemoo-re:main Oct 20, 2022
@github-actions github-actions bot mentioned this pull request Oct 20, 2022
manuelmeister pushed a commit to manuelmeister/astro-iconify that referenced this pull request Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants