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

Gatsby-plugin-manifest icon producing pngs and svg - but svg is not preferred icon of choice #26083

Closed
RyanPinPB opened this issue Jul 28, 2020 · 7 comments
Labels
topic: plugins-PWA Issues related to PWA: the gatsby-plugin-offline and gatsby-plugin-manifest plugins type: upstream Issues outside of Gatsby's control, caused by dependencies

Comments

@RyanPinPB
Copy link

Description

In gatsby-config.js I am using gatsby-plugin-manifest and my goal is to have my favicon.svg file copied into the public folder on build, and be the preferred favicon for browsers that support .svg files (Chrome).

The svg is being copied using 'auto' mode of the manifest, however, the manifest is also making .png version of the icon (as it's suppose to I believe) to be used as a backup. My issue is that Chrome is selecting to use the .png file instead of the .svg.

This svg allows for dark/light mode variations of the favicon, so I would prefer to use it.

The public index.html has two links for the icon, w/ the PNG listed after the SVG, I'm not sure if that is causing the issue.

Steps to reproduce

My github (w/ some code commented out in the gatsby-config.js file. I tried using the manual 'icons' array but the gatsby develop command stalled at the point of "buliding manifest icons"

https://github.com/RyanPinPB/pdm-gatsby

Expected result

When on a browser that supports using SVG for favicons, favicon.svg should be selected.

When browser is in dark mode, dark mode should trigger the SVG media query, causing the svg to invert colors (white/black)

Actual result

favicon-32x32.png is being selected by chrome

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

gatsby info --clipboard

ERROR

UNHANDLED REJECTION (e || []).filter is not a function

TypeError: (e || []).filter is not a func tion

  • envinfo.js:1
    [lib]/[gatsby-cli]/[envinfo]/dist/envin fo.js:1:73314

  • task_queues.js:93 processTicksAndReject ions
    internal/process/task_queues.js:93:5

  • async Promise.all

@RyanPinPB RyanPinPB added the type: bug An issue or pull request relating to a bug in Gatsby label Jul 28, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 28, 2020
@RyanPinPB
Copy link
Author

@moonmeister This is the favicon svg issue we talked about

@moonmeister moonmeister added the topic: plugins-PWA Issues related to PWA: the gatsby-plugin-offline and gatsby-plugin-manifest plugins label Jul 28, 2020
@moonmeister
Copy link
Contributor

moonmeister commented Jul 28, 2020

So far my testing is showing that making the SVG come second fixes the issue in Chrome. But, http://dahlström.net/svg/favicon/favicon.html has the PNG coming second and works correctly, so there is something else at play here. It's maybe the "Alternate" attr in rel. I'll see if that's it, I can't find any documentation to suggest that order should affect the icon choice, it's possible this is a Bug in chrome but we'll need to narrow down the issue if it is.

@moonmeister
Copy link
Contributor

moonmeister commented Jul 28, 2020

Alright, this is definitely a Chrome Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1104663. Probably fairly new given someone else JUST reported it. I commented with my experience here: https://bugs.chromium.org/p/chromium/issues/detail?id=1104663#c13

Anyone having this issue should star the Chromium Bug report to indicate you've had the problem.

@moonmeister moonmeister added type: upstream Issues outside of Gatsby's control, caused by dependencies and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby labels Jul 28, 2020
@github-actions

This comment has been minimized.

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Aug 18, 2020
@moonmeister moonmeister added not stale and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Aug 18, 2020
@ciromattia
Copy link
Contributor

Comments in Chrome bugreport report that there's no "right" behaviour, though, and there are only 4 watchers so I'm expecting the current behaviour will remain for long time.

Is there any userland solution, besides forking and hacking the plugin (which I'd prefer not to do)?

@moonmeister
Copy link
Contributor

Yes, we need to swap the order of the elements in DOM, I believe that also fixes this. If you'd like to open a PR that'd be appreciated.

@moonmeister
Copy link
Contributor

Oh, just saw the PR thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: plugins-PWA Issues related to PWA: the gatsby-plugin-offline and gatsby-plugin-manifest plugins type: upstream Issues outside of Gatsby's control, caused by dependencies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants