-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Make video thumbnails have certain height before image loading starts to avoid layout shifts #4723
Make video thumbnails have certain height before image loading starts to avoid layout shifts #4723
Conversation
…ts to avoid layout shifts
|
||
.thumbnailImage.thumbnailLoading { | ||
// Makes img element sized correctly before image loading starts | ||
aspect-ratio: 16 / 9; |
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.
According to the aspect-ratio docs on MDN, you can do this for images, which will make it use 16/9 until the image is downloaded and after that use the image's aspect ratio.
That would allow you to remove the javascript and the thumbnail loading class.
aspect-ratio: 16 / 9; | |
aspect-ratio: 16/9 auto; |
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.
And it's done
* development: (29 commits) Translated using Weblate (Chinese (Traditional)) Fix URL copied via right click menu (FreeTubeApp#4690) Translated using Weblate (Croatian) Wrap ft-icon buttons below before they go fully vertical (FreeTubeApp#4735) * Make activating a chapter selector makes window scroll to top like clicking on timestamp links (FreeTubeApp#4722) Translated using Weblate (Portuguese (Brazil)) Translated using Weblate (Portuguese (Brazil)) Make video thumbnails have certain height before image loading starts to avoid layout shifts (FreeTubeApp#4723) Update subscription cache when visiting a channel (FreeTubeApp#4667) Fix fallback to Invidious for the podcasts channel tab (FreeTubeApp#4731) Translated using Weblate (Portuguese (Brazil)) Translated using Weblate (Arabic) Translated using Weblate (Polish) Translated using Weblate (Dutch) Translated using Weblate (Icelandic) Translated using Weblate (Spanish) Translated using Weblate (Arabic) Translated using Weblate (Icelandic) Translated using Weblate (Italian) Translated using Weblate (Chinese (Simplified)) ...
* development: (161 commits) Add video search in user playlist feature (FreeTubeApp#4622) Add discussion info when opening an issue (FreeTubeApp#4676) Translated using Weblate (Lithuanian) Translated using Weblate (Serbian) Translated using Weblate (Estonian) Bump mini-css-extract-plugin from 2.8.0 to 2.8.1 (FreeTubeApp#4742) Bump electron from 28.2.3 to 29.1.0 (FreeTubeApp#4743) Bump lefthook from 1.6.1 to 1.6.4 (FreeTubeApp#4740) Bump the babel group with 2 updates (FreeTubeApp#4739) Bump swiper from 11.0.6 to 11.0.7 (FreeTubeApp#4741) Bump electron-builder from 24.12.0 to 24.13.3 (FreeTubeApp#4744) Split view count and published date into two lines on small displays (FreeTubeApp#4736) Translated using Weblate (Chinese (Traditional)) Fix URL copied via right click menu (FreeTubeApp#4690) Translated using Weblate (Croatian) Wrap ft-icon buttons below before they go fully vertical (FreeTubeApp#4735) * Make activating a chapter selector makes window scroll to top like clicking on timestamp links (FreeTubeApp#4722) Translated using Weblate (Portuguese (Brazil)) Translated using Weblate (Portuguese (Brazil)) Make video thumbnails have certain height before image loading starts to avoid layout shifts (FreeTubeApp#4723) ... # Conflicts: # src/renderer/views/Playlist/Playlist.vue
Pull Request Type
Related issue
Similar to #4713
Description
As title
The constant aspect ratio is only applied before image loading finished (no idea how to detect image loading start) in case the image got different aspect ratio
Screenshots
Image loading not started yet

Image loaded started

Testing
Replace HTTP Cache
(so that renderer does the image loading)Desktop
Additional context