Prevent layout shifts when thumbnails load in the chapter selector (#4713)

This commit is contained in:
absidue 2024-02-26 18:02:08 +01:00 committed by GitHub
parent 2647e7cb58
commit 81ce77598f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -54,7 +54,6 @@
.chapterThumbnail {
grid-area: thumbnail;
inline-size: 130px;
block-size: auto;
margin: 3px;
}

View File

@ -46,13 +46,15 @@
@keydown.space.stop.prevent="changeChapter(index)"
@keydown.enter.stop.prevent="changeChapter(index)"
>
<!-- Setting the aspect ratio avoids layout shifts when the images load -->
<img
v-if="!compact"
alt=""
aria-hidden="true"
class="chapterThumbnail"
loading="lazy"
:src="chapter.thumbnail"
:src="chapter.thumbnail.url"
:style="{ aspectRatio: chapter.thumbnail.width / chapter.thumbnail.height }"
>
<div class="chapterTimestamp">
{{ chapter.timestamp }}

View File

@ -450,7 +450,7 @@ export default defineComponent({
timestamp: formatDurationAsTimestamp(start),
startSeconds: start,
endSeconds: 0,
thumbnail: chapter.thumbnail[0].url
thumbnail: chapter.thumbnail[0]
})
}
} else {