-
Notifications
You must be signed in to change notification settings - Fork 685
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
Images Appear #2164
Images Appear #2164
Conversation
|
I wonder if |
Good thought. This article is dated June 2018 but I found May be worth trying again in Chrome 80 since we didn't see this bug until then. |
Yep, I think you're right: https://codesandbox.io/s/nervous-minsky-rwqz1 There's an image with When you remove the |
So I'm pretty confident we can fix that in our code but the question becomes why does Chrome think our |
I'm wondering if Chromium sees the Is there a reason you need two images with different
The placeholder I would simplify and not have a loading image. There's a lot happening to support that, but I'd think it's really only important to anchor the physical space. Whether that's a filled by a solid, transparent, or image is secondary / depends on the design. Aside: isn't base64 decoding a PNG bad for performance on most devices? I recall research that it was always better to take the HTTP hit and have the physical file in cache. Even for an SVG there was a limit to the gain of inlining the markup vs referencing a file source. If the SVG itself was complex the DOM size bloat from repetition was again worse than the one-time HTTP hit. |
Update: editing that sandbox, it doesn't matter whether the images are in the viewport initially or not. If they have So THEN the question becomes why do some of the images work just fine and others don't? 🤪 Edit: Chromium only requests the 2KB placeholder image to approximate dimensions if dimensions aren't already explicitly set. This explains why this affected images (like the |
PR Updated:
Chromium@80 does request images that are Speaking of small code changes, since this is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof. Well at least we fixed it :o
@supernova-at Not sure if its related to your changes but somehow its happening on this PR. On Win10-Edge - Home page image does not load. Same works if I test on Also same I could reproduce on Safari browser. Whenever Response Header |
The reasoning behind the technique used here is that the layout behavior of However... Since we only use a single, fixed-size placeholder, we're not really gaining anything with this technique. If it's fixed, then the CSS might as well know the size, and we have precedent for doing so in other places by letting the component pass sizes to the stylesheet via CSS variables. Worth a PR in the future probably.
I doubt it's that bad for a tiny PNG ( |
} | ||
|
||
.notLoaded { | ||
composes: loaded; | ||
display: none; | ||
visibility: hidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this PR, but for posterity, I have to note here that the way this was done (originally) was not the recommended approach.
- the styles on
.loaded
should be on.image
.loaded
should compose.image
.notLoaded
should not compose.loaded
. notLoaded
should compose.image
and overridevisibility
- (most importantly)
.image
should not be applied directly to the component
@jimbo That makes sense. FWIW, we might go simpler and have I've never worked on a Magento site that didn't have a standard aspect ratio for product images as part of product data acceptance (overwhelmingly 1:1 but the fashion-torso prevails). There are cases we carve a recess for |
Chrome, Firefox, Win10-latest Edge, Android Chrome loads images fine. |
* Removes manual hiding of images * Updates snapshots * Uses visibility instead of display to hide images until they load Co-authored-by: Devagouda <40405790+dpatil-magento@users.noreply.github.com>
Description
This PR updates some CSS handling in our
Image
component to no longer applydisplay: none
to images that we think haven't loaded yet, since Chromium (as of version 80) is no longer requesting those images.Instead, we set
visibility: hidden
. Chromium still sends off the request and nothing else downstream needs to change.Related Issue
Closes PWA-367.
Acceptance
Verification Stakeholders
@jimbo
Specification
Verification Steps
Venia
yarn watch:venia
/pomona-skirt.html
Storybook
yarn workspace @magento/venia-ui run storybook
Image
component load correctlyScreenshots / Screen Captures (if appropriate)
Checklist