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

Add intrinsicsize attributes to images #144

Merged
merged 1 commit into from
Feb 8, 2019
Merged

Conversation

mathiasbynens
Copy link
Member

Automated using the following quick and dirty script:
https://gist.github.com/mathiasbynens/c10709d79d5185f08246fbb9d562fee3

cc @loonybear @ojanvafai

This caused me to ponder the following question: WICG/intrinsicsize-attribute#3 (comment) This patch always uses the intrinsic size of the image in the src attribute, ignoring srcset (which I assume is the way to go).

@mathiasbynens mathiasbynens merged commit e0a0005 into master Feb 8, 2019
@mathiasbynens mathiasbynens deleted the intrinsicsize branch February 8, 2019 10:45
@mathiasbynens
Copy link
Member Author

mathiasbynens commented Feb 8, 2019

This change makes such a big difference!

  1. Go to e.g. https://v8.dev/blog/fast-async#improved-developer-experience
  2. Do a hard refresh (+Shift+R)

Result on Chrome 72: the page keeps jumping around until all images have loaded.
Video: https://www.youtube.com/watch?v=M1V9xv6kPNk

Result on Chrome Canary with chrome://flags/#enable-experimental-web-platform-features enabled: no jumping around at all.
Video: https://www.youtube.com/watch?v=22jO87vnWSs

@backes
Copy link
Member

backes commented Feb 8, 2019

Awesome! This removes a constant annoyance on many pages.
Didn't know about this new feature until now :)

@tigt
Copy link

tigt commented Feb 8, 2019

This patch always uses the intrinsic size of the image in the src attribute, ignoring srcset (which I assume is the way to go).

I believe you’re right — Images with only srcset and no <picture> wrapper should only change size, not aspect ratio.

It’s possible they could be badly behaved and do so anyway, but that’s on them and you can’t fix it.

@ojanvafai
Copy link

Hmmm...this change makes the experience better even just for the images that are onscreen since the onscreen text doesn't move around when the image loads. But...the page shouldn't jump around even without this change. Scroll anchoring should prevent it. I think this is showing a bug in scroll anchoring that's probably worth filing.

@mathiasbynens mathiasbynens added the meta Issues involving the build process or the website itself, rather than its content label Feb 18, 2019
@mathiasbynens
Copy link
Member Author

mathiasbynens added a commit that referenced this pull request Apr 5, 2019
For now, this remains a manual step. We don’t want to slow down all builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes meta Issues involving the build process or the website itself, rather than its content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants