-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
The placeholder image in "gatsby-image" does not fade on Safari #8323
Comments
Not sure if I am misunderstanding the issue, but could you check the css of the placeholder <div class="gatsby-image-wrapper">
<img> <!-- CHECK IF THIS HAS opacity: 0 -->
<picture></picture>
</div> Also, is this working correctly with another browser? EDIT: I think I have spotted the issue, working on it. |
Hmm, that's weird - gatsby/packages/gatsby-image/src/index.js Lines 214 to 219 in 208547f
You could check if onLoad gets called by passing it as a prop to <Img onLoad={() => console.log('Image loaded!')} /> , or you could check with the React DevTools, if you have it installed in your browser. (Unfortunately I cannot check myself because Safari has no linux version).
Related to the issue that I think I spotted: in Firefox/Chrome does the placeholder actually fade out, or just gets invisible. Because it seems the placeholder |
One more thought: difference between Safari and Firefox/Chrome is that the latter support |
After having experimented a bit, polyfilling |
That would be great, thanks! |
I'll let @KyleAMathews answer for himself, but I'm not sure we'd want to include a polyfill explicitly within gatsby-image. We can (and probably should!) document the usage of such polyfill(s) and mention how to use them, but I don't think I like the idea of an explicit polyfill. That said, I'm also not 100% sure I'm seeing the issue. The images appear to load fine for me in Safari ( |
Maybe we can figure this out together. AFAICS the placeholder |
@JakeRider that example is a lot more helpful! I think I've seen something similar on a site I helped out with. Scroll down to the "We've worked with amazing clients" section. Note: this is before some of the gatsby-image v2 stuff was shipped, so it's a bit out of date. (the opacity is still 1 here on the placeholder image, which should be the same issue) I'm game to help figure this out too. @stefanprobst I think if I use the above site's source, we could debug it pretty easily. |
Sounds good! The issue should also be visible on a simple default starter (link to repo). Could you (or somebody with Safari) check? This is what I see when I manually set the opacity on the placeholder: |
Possible duplicate of #7539 ? |
@stefanprobst I wouldn't say that's a duplicate, I would say that (hopefully!) that fixes this issue! 🤞 I can pull it down locally and try in a bit. |
Thanks! The actual issue this PR is trying to solve has this comment that looks very similar to what seems to be happening here. |
@JakeRider Sorry for getting back at this so late. I have tried to clean-up gatsby-image a bit (esp. removing stuff from state that does not need to live there). This is not a proper PR (yet), but if you're willing to try this out I'd be very interested if it fixes this particular issue. You can install the component directly from my github: yarn add https://github.com/stefanprobst/gatsby-image-compact Then adjust your imports from |
Not yet. You could try if #7539 (or my test repo above) fixes the issue for you and report back here. |
This should be fixed in |
This issue perfectly describes a bug I hit, but my google-fu is failing me. I can't find any other traces of this & my project's dependencies are all up to date. Should I upload a simplified reproduction? |
@samselikoff Before you spend time on a repro, are you seeing this lack of fading in a version of Safari that supports If it doesn't, the first thing you might try is polyfilling |
Hm I did try using this technique I believe #10435 but I can double check |
Also I’m seeing this on latest Safari on my desktop so I don’t think it’s the issue |
Hmm...actually, yeah: I can confirming I'm also currently seeing this lack of fading on https://using-gatsby-image.gatsbyjs.org in the latest Safari as well. |
Yes, exactly. Looks like the placeholder is just disappearing. |
Should we open a new issue? |
Probably a good idea, with a link to this one in the description for context. Glad you spotted this! |
Description
The low-res placeholder image that gatsby-image generates is not fading out on Safari, both on desktop and mobile. You can see it happening at the gatsby-image example site. It becomes an issue when using images with transparency, as you can still see parts of the placeholder.
Steps to reproduce
Use gatsby-image on Safari. https://using-gatsby-image.gatsbyjs.org is a good example, but it seems to affect any site built with Gatsby. My project, the gatsby-image demo site, and the main Gatsby site are all being affected from what I saw.
Expected result
The placeholder should fade out after the main image loads.
Actual result
The placeholder remains opaque, and the main image loads over top of it.
Environment
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.8.0 - ~/.nvm/versions/node/v10.8.0/bin/node
npm: 6.4.1 - ~/.nvm/versions/node/v10.8.0/bin/npm
Browsers:
Chrome: 68.0.3440.106
Safari: 12.0
npmGlobalPackages:
gatsby-cli: 2.4.0
The text was updated successfully, but these errors were encountered: