-
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, again #20126
Comments
Interestingly, setting |
Hi! I tested it on my Catalina MacBook with Safari 13.0.3 and don't see this behavior. Please provide a reproduction and video of what you're seeing. Thanks! |
Sure thing! Here's a video: https://www.youtube.com/watch?v=Rh0gXnIiC7k. Safari's on the left, Chrome on the right, and as you can see in Safari the placeholder never fades away – it just disappears. I'm just visiting https://using-gatsby-image.gatsbyjs.org/ in both browsers. I'm on Catalina and Safari 13.0.4. In the other issue @ooloth also confirmed seeing the issue on the demo site. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Not stale. I am also experiencing this on iOS safari with sometime the placeholder not fading even when the image is loaded. |
I'm also experiencing it on iOS (13) and desktop Safari (Catalina, Safari 13.0.3). It's especially harsh if you don't use any type holder, i.e. Here's a demo video in Safari: https://www.youtube.com/watch?v=PqLYXdaqSCI Looks like in Chrome, the |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Not stale. I've added reproduction details and it was confirmed as a bug. |
Not stale |
Same issue here! |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hmm. In general, this auto-closing action is not cool. I understand closing an issue after awhile if the Gatsby team has tried to address it but the reporter has stopped responding. But when the reporter has responded with the requested reproduction and the delay is on Gatsby's end (totally fine), the issue should not be in danger of closing. Perhaps the action can bypass issues labelled |
I had this issue too! A temporary workaround is to add this to your CSS:
|
It seems the issue is related to this line https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-image/src/index.js#L395 When I change it to |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
Probably need to open a new issue now, since contributors can no longer open issues or add the I added the Can you clarify that the issue still happens on a slower connection (assuming Safari has network throttle in it's devtools like Chrome and Firefox do), and disable/empty the browser cache. One more thing. When you navigate between pages, the images shouldn't be fading in? But you want them to when visiting a page directly(via new tab or entering the URL) regardless of if the image needs to download or not? It should still do the fadein transition when first encountering the image (browser hasn't seen it before to cache it). Here's my current PR(not a direct PR fix for this, but reworks cache logic), feel free to give that a try too. |
Confirmed with @steverandy via Discord. For whatever reason Safari is apparently setting I would appreciate if anyone else can test in Safari to confirm this. |
Same issue here. I am using fadeIn effect for the gatsby image therefore it's not working on safari/ IOS 13. |
@lucashfreitas are you testing in a fresh browser instance (eg private/incognito session) with the browser dev tools open for the network tab and disabling+clearing the browsers cache? If so can you modify the You can copy the JS source code from this repo package of this.setState({ isVisible: true }, () => {
const imgCached = this.imageRef.current && this.imageRef.current.currentSrc
console.log(`imageCached is: ${imageCached}, as boolean: ${!!(imageCached)}`)
this.setState({
imgLoaded: imageInCache,
imgCached: !!(imageCached),
})
}) Then report back the value logged to console. If you test with another browser like Chrome in the same way, it should be false(empty string) with cache disabled, and then if you enable browser caching again, refreshing when it has been cached locally (and uses memory cache) should report it as true with the asset URL.
I find it odd that Safari would be having a value that sets that to true when the asset has not been pulled from the cache, no other browser exhibits this behaviour that I've tested, including other webkit based browsers. Also, please do test this with production, or at least |
This is still happening to me. Is there any known workaround while we wait for a possible PR? |
@nelsonvassalo it'd be helpful if you could follow the instructions in my previous comment above. And answer the questions about expectations. Safari should have native image lazy loading support in it's next release which may make the issue go away, but it'd be nice to get proper confirmation from other users following my instructions above before that happens. |
Happening to me on Safari 13.1 on macOS and on iOS 13.5.1. I've applied the CSS fix for now but will try and test out your instructions in the coming days @polarathene |
Hi @polarathene sorry. Yes I went ahead and applied the CSS fix but it has to be done with an |
@nelsonvassalo I didn't advise that. I asked you to test some modifications to
|
@polarathene as I understand from following this thread, this issue is caused by a known Safari bug and the only workaround is the CSS fix at the moment (AFAIK).
Without that CSS override, the fade in transitions never happen in Safari, whether or not the image is already cached. With that CSS override it works every time. The consensus seems to be that Safari thinks it has the image cached when it doesn't. For me this applies to both gatsby build/serve and gatsby develop, as well as in production for every Gatsby site I've built. Even after the Safari fix is rolled out by Apple, we'll still need to support the previous few versions at best. I think the hope is that the workaround could be implemented in the Gatsby Image component directly rather than having to apply this CSS bandaid (though I just include it in my boilerplate global CSS for every Gatsby project). I think this issue should be re-opened. |
I can reproduce this with Safari 13.1.2 |
If the above CSS fixes things, I'd love to have it PRed into gatsby-image directly. |
Please follow the instructions I have detailed here. Provide me with actual console output as requested, and confirm what your expectations actually are from the described scenarios. I'm well aware that Safari users are having an issue, but what has not been clarified is if this entirely the fault of code or also partially a mismatch of expectations. The native lazy load support for img arrived after If the behaviour on a throttled 3G connection in Safari shows no fade in transition when it should and the browser cache is cleared (thus the throttled connection delays the image loading with the placeholder enough and you can actually see a download is happening in the network tools), that is an issue. When observing the network transfer, note that If I had a macOS system with Safari I would validate all this myself properly. Please let me know what the console output is when making the modifications to What value is Safari setting that causes To clarify, there are several "caches" involved here.
I have a WIP PR that brings |
@KyleAMathews you can remove Note, reverting this will trade one browser specific problem for another. You previously wanted fadein disabled if the image had been detected as cached in the browser. Related PR that fixed that by adding You can either chalk it up to a hacky detection solution or Safari behaving against expectations, all other browsers either return true when actually valid, and false if not in the cache or if the
It's in |
I received another report of the issue that answered enough of what I had requested from a Safari user, sorry for how long you've all been affected by this. PR available, I've not tested it, but it should make Safari users of For clarification, the placeholder transition will happen on first load of the image, there is still an internal |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
This is still happening... affects all browsers and is intermittent. Sounds like an on-going problem. |
Pretty sure I had an optimal fix and contributed it, but the review process dragged on and despite the encouragement with feedback to satisfy merging some were rejected in favor of a replacement image component that was rewritten but still in an alpha/beta state at the time IIRC. Some of my fixes were ported over with no attribution. I don't have time to look through my PR history on the repo, but you should be able to see what progress I made, I documented plenty of it (in rather verbose comments or commit messages in the PRs). If I did resolve it, then you might be able to point someone to that solution to port it over to whatever Gatsby uses now. I didn't appreciate how that experience panned out, so I no longer contribute or use Gatsby personally. |
Yeah I seem to be having this problem as well. Edit: I updated the related modules and it was still doing this when using |
This issue was fixed some time ago (#8323), but it seems to have crept up again.
You can see it by visiting https://using-gatsby-image.gatsbyjs.org/ on Safari. The placeholder does not fade in, it just disappears.
Let me know if you need more context!
The text was updated successfully, but these errors were encountered: