-
Notifications
You must be signed in to change notification settings - Fork 62
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
www.ikea.com - design is broken #113635
Comments
This is the code when the image is not being loaded. <div class="dl-card__image">
<span
class="dl-aspect-ratio-image dl-aspect-ratio-image--wide dl-card__image-aspect-ratio"
><div
data-gatsby-image-wrapper=""
class="gatsby-image-wrapper gatsby-image-wrapper-constrained"
suppresshydrationwarning="true"
>
<div style="max-width: 1000px; display: block">
<img
alt=""
role="presentation"
aria-hidden="true"
src="data:image/svg+xml;charset=utf-8,%3Csvg height='718' width='1000' xmlns='http://www.w3.org/2000/svg' version='1.1'%3E%3C/svg%3E"
style="max-width: 100%; display: block; position: static"
/>
</div></div
></span>
</div> And this is the code when the image is being loaded. <div class="dl-card__image">
<span
class="dl-aspect-ratio-image dl-aspect-ratio-image--wide dl-card__image-aspect-ratio"
><div
data-gatsby-image-wrapper=""
class="gatsby-image-wrapper gatsby-image-wrapper-constrained"
suppresshydrationwarning="true"
>
<div style="max-width: 1000px; display: block">
<img
alt=""
role="presentation"
aria-hidden="true"
src="data:image/svg+xml;charset=utf-8,%3Csvg height='718' width='1000' xmlns='http://www.w3.org/2000/svg' version='1.1'%3E%3C/svg%3E"
style="max-width: 100%; display: block; position: static"
/>
</div>
<img
aria-hidden="true"
data-placeholder-image=""
style="opacity: 0; transition: opacity 500ms linear; object-fit: cover"
decoding="async"
src="data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAOABQDASIAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAAAAMEAgX/xAAVAQEBAAAAAAAAAAAAAAAAAAAAAf/aAAwDAQACEAMQAAABqbxrJdiQ/8QAGRABAQEBAQEAAAAAAAAAAAAAAQIREhMh/9oACAEBAAEFAs6eflYJTL6K0zv/xAAUEQEAAAAAAAAAAAAAAAAAAAAQ/9oACAEDAQE/AT//xAAUEQEAAAAAAAAAAAAAAAAAAAAQ/9oACAECAQE/AT//xAAaEAEAAgMBAAAAAAAAAAAAAAAAASERMUKh/9oACAEBAAY/AqlhtUr8dP/EABoQAAMBAAMAAAAAAAAAAAAAAAABESFhcYH/2gAIAQEAAT8hl0yVfsSAM2TFQv0NW3vlH//aAAwDAQACAAMAAAAQ2C//xAAWEQEBAQAAAAAAAAAAAAAAAAAAETH/2gAIAQMBAT8Q1X//xAAWEQEBAQAAAAAAAAAAAAAAAAABABH/2gAIAQIBAT8QcLC//8QAGxABAAIDAQEAAAAAAAAAAAAAAQARITFhQfD/2gAIAQEAAT8QriGt7zFAzDRvr5EKNnIdIFZuMq1hbk10jp9y+if/2Q=="
alt=""
/><picture
><source
type="image/webp"
srcset="
/us/en/home-design/static/977d4773fdd6e9c4a336afb08f13682f/52dbe/showroom-1.webp 250w,
/us/en/home-design/static/977d4773fdd6e9c4a336afb08f13682f/85d7d/showroom-1.webp 500w,
/us/en/home-design/static/977d4773fdd6e9c4a336afb08f13682f/b4d58/showroom-1.webp 1000w
"
sizes="(min-width: 1000px) 1000px, 100vw" />
<img
data-main-image=""
style="object-fit: cover; opacity: 1"
sizes="(min-width: 1000px) 1000px, 100vw"
decoding="async"
loading="eager"
src="/us/en/home-design/static/977d4773fdd6e9c4a336afb08f13682f/41a63/showroom-1.jpg"
srcset="
/us/en/home-design/static/977d4773fdd6e9c4a336afb08f13682f/87461/showroom-1.jpg 250w,
/us/en/home-design/static/977d4773fdd6e9c4a336afb08f13682f/1f3b1/showroom-1.jpg 500w,
/us/en/home-design/static/977d4773fdd6e9c4a336afb08f13682f/41a63/showroom-1.jpg 1000w
"
alt=""
width="1000"
height="718" /></picture
><noscript></noscript></div
></span>
</div> |
I suspect a glitch in native image lazy loading. and also webpack://design-lab-frontend/src/components/gatsby-image.browser.tsx // The plugin image component is a bit special where if it's server-side rendered, we add extra script tags to support lazy-loading without
// In this case we stop hydration but fire the correct events.
const ssrImage = root.current.querySelector(
`[data-gatsby-image-ssr]`
) as HTMLImageElement
if (ssrImage && hasNativeLazyLoadSupport()) {
if (ssrImage.complete) {
// Trigger onStartload and onLoad events
onStartLoad?.({
wasCached: true,
})
onLoad?.({
wasCached: true,
})
// remove ssr key for state updates but add delay to not fight with native code snippt of gatsby-ssr
setTimeout(() => {
ssrImage.removeAttribute(`data-gatsby-image-ssr`)
}, 0)
} else {
onStartLoad?.({
wasCached: true,
})
ssrImage.addEventListener(`load`, function onLoadListener() {
ssrImage.removeEventListener(`load`, onLoadListener)
onLoad?.({
wasCached: true,
})
// remove ssr key for state updates but add delay to not fight with native code snippt of gatsby-ssr
setTimeout(() => {
ssrImage.removeAttribute(`data-gatsby-image-ssr`)
}, 0)
})
}
imageCache.add(cacheKey)
return
}
if (renderImage && imageCache.has(cacheKey)) {
return
} |
It looks very similar to gatsbyjs/gatsby#35628 |
In Safari technical preview, deactivating lazy loading makes the site slower, but the images load every time. |
This is probably outreach to ikea. |
I’ll pick this up and bring it to the appropriate team. |
Thanks for the report, Karl. The images do not load on every refresh. I was not able to reproduce the issue on Safari. (5/5 tries) Tested on: Notes:
Moving to Needsdiagnosis. [qa_45/2022] |
So this page is currently going through a redevelopment which should resolve this, but in the event that the component continues to be used they’ll work to fix this now that they know the issue. Thanks for highlighting the problem @karlcow, and I’ll keep an eye on it. |
@robinwhittleton just for the record, y'all shipping sourcemaps into production is so much appreciated. ❤️ it makes our work of diagnosing web-compat issues soooooo much easier. :) If you run into any browser specific issues, please report them on webcompat.com, and we'll take a look at it! For now, I'll move this issue into sitewait, as there is nothing for us to do here. |
This! Thanks a lot. |
Tracked at Apple with rdar://101657305 |
How will we know when Ikea pushes a fix for this? Do we just need to check the site periodically, or will someone notify us here? |
I’m at IKEA, so you can poke me. But I’m not in the team that owns this, and I have no update on timing at the moment. |
When it succeeds the image being displayed by Safari is:
https://www.ikea.com/us/en/home-design/static/977d4773fdd6e9c4a336afb08f13682f/b4d58/showroom-1.webp BUT my impression is that images are always loaded, but then the DOM is being rewritten. When we deactivate lazy loading, it's always working. which means it never goes through this code which is in the HTML source, where I replaced: const hasNativeLazyLoadingSupport =
"undefined" != typeof HTMLImageElement &&
"loading" in HTMLImageElement.prototype;
if (hasNativeLazyLoadingSupport) {
const t = document.querySelectorAll("img[data-main-image]");
for (let e of t) {
e.dataset.src &&
(e.setAttribute("src", e.dataset.src), e.removeAttribute("data-src")),
e.dataset.srcset &&
(e.setAttribute("srcset", e.dataset.srcset),
e.removeAttribute("data-srcset"));
const t = e.parentNode.querySelectorAll("source[data-srcset]");
for (let e of t)
e.setAttribute("srcset", e.dataset.srcset),
e.removeAttribute("data-srcset");
e.complete &&
((e.style.opacity = 1),
(e.parentNode.parentNode.querySelector(
"[data-placeholder-image]"
).style.opacity = 0));
}
} This script seems to be repeated as much as they are images in the document. There is another similar script in the const e =
"undefined" != typeof HTMLImageElement &&
"loading" in HTMLImageElement.prototype;
e &&
document.body.addEventListener(
"load",
function (e) {
const t = e.target;
if (void 0 === t.dataset.mainImage) return;
if (void 0 === t.dataset.gatsbyImageSsr) return;
let a = null,
n = t;
for (; null === a && n; )
void 0 !== n.parentNode.dataset.gatsbyImageWrapper &&
(a = n.parentNode),
(n = n.parentNode);
const o = a.querySelector("[data-placeholder-image]"),
r = new Image();
(r.src = t.currentSrc),
r
.decode()
.catch(() => {})
.then(() => {
(t.style.opacity = 1),
o &&
((o.style.opacity = 0),
(o.style.transition = "opacity 500ms linear"));
});
},
!0
); all these scripts are wrapped into <script type="module"></script> There are 18 instances of them. The one in the head is the one called a lot. Around ~160 times There is something looking like a race issue in all of these. |
Removing all the individual scripts module for each image with a local override in Web Inspector dev tools in Safari doesn't fix the issue. So There is something else going on. |
The last piece of code checking for Lazy Loading is: const e = k.current.querySelector("[data-gatsby-image-ssr]");
if (e && l())
return (
e.complete
? (null == g ||
g({
wasCached: !0,
}),
null == h ||
h({
wasCached: !0,
}),
setTimeout(() => {
e.removeAttribute("data-gatsby-image-ssr");
}, 0))
: (null == g ||
g({
wasCached: !0,
}),
e.addEventListener("load", function t() {
e.removeEventListener("load", t),
null == h ||
h({
wasCached: !0,
}),
setTimeout(() => {
e.removeAttribute("data-gatsby-image-ssr");
}, 0);
})),
void I.add(C)
); which is in fact const ssrImage = root.current.querySelector(
`[data-gatsby-image-ssr]`
) as HTMLImageElement
if (ssrImage && hasNativeLazyLoadSupport()) {
if (ssrImage.complete) {
// Trigger onStartload and onLoad events
onStartLoad?.({
wasCached: true,
})
onLoad?.({
wasCached: true,
})
// remove ssr key for state updates but add delay to not fight with native code snippt of gatsby-ssr
setTimeout(() => {
ssrImage.removeAttribute(`data-gatsby-image-ssr`)
}, 0)
} else {
onStartLoad?.({
wasCached: true,
})
ssrImage.addEventListener(`load`, function onLoadListener() {
ssrImage.removeEventListener(`load`, onLoadListener)
onLoad?.({
wasCached: true,
})
// remove ssr key for state updates but add delay to not fight with native code snippt of gatsby-ssr
setTimeout(() => {
ssrImage.removeAttribute(`data-gatsby-image-ssr`)
}, 0)
})
}
imageCache.add(cacheKey)
return
} Gatsby 4.24.1 is used. Current Gatsby is 5.0 I need to dig a bit more there |
ok I'm 100% sure now that the issue is happening in this part of the code that the issue is. const e = k.current.querySelector("[data-gatsby-image-ssr]");
if (e && l())
return e.complete ? (null == g || g({
wasCached: !0
}), null == h || h({
wasCached: !0
}), setTimeout((() => {
e.removeAttribute("data-gatsby-image-ssr")
}), 0)) : (null == g || g({
wasCached: !0
}), e.addEventListener("load", (function t() {
e.removeEventListener("load", t),
null == h || h({
wasCached: !0
}),
setTimeout((() => {
e.removeAttribute("data-gatsby-image-ssr")
}), 0)
}))), void I.add(C); If I just change
by
so that it is never executed. The images are always displayed. Modifying the code a bit to better understand. const e = k.current.querySelector("[data-gatsby-image-ssr]");
const wasCachedTrue = { wasCached: !0 };
if (e && l()) {
if (e.complete) {
console.log("e.complete OK");
null == g || g(wasCachedTrue),
null == h || h(wasCachedTrue),
setTimeout(() => {
e.removeAttribute("data-gatsby-image-ssr");
}, 0);
} else {
console.log("e.complete NOT OK");
null == g || g(wasCachedTrue),
e.addEventListener("load", function t() {
e.removeEventListener("load", t),
null == h || h(wasCachedTrue),
setTimeout(() => {
e.removeAttribute("data-gatsby-image-ssr");
}, 0);
});
}
void I.add(C);
} Each time the images are NOT displayed is when we reach the second part of the condition aka when |
@robinwhittleton This is still happening. Steps to reproduce
Expected: Actual: |
The rebuild on this page has (I believe) happened, and I can’t replicate the issue any more in either Firefox or Safari TP. |
Indeed, images seem to load fine now. Thank you so much. <3 |
I will test without the Quirks for Safari |
This is working for me too. I will remove the Quirk. |
URL: https://www.ikea.com/us/en/home-design/
Browser / Version: Firefox 108.0
Operating System: Mac OS X 10.15
Tested Another Browser: Yes Safari
Problem type: Design is broken
Description: Images not loaded
Steps to Reproduce:
Expected:
Images visible
Actual:
Some images are missing.
Notes:
This happens in Firefox NIghtly and Safari Tech Preview but not able to reproduce in Chrome Canary.
View the screenshot
Browser Configuration
From webcompat.com with ❤️
The text was updated successfully, but these errors were encountered: