fix(frontend): prevent avatar layout shift while loading

The .avatar img in User.vue relied solely on the width/height HTML
attributes for sizing. Those are presentational hints with zero CSS
specificity, so Bulma's global reset (img { height: auto; max-width: 100% })
overrode them. While avatarSrc was still resolving (initial src=""),
the browser had no intrinsic dimensions to compute the auto height from
and fell back to the broken-image box (~96px in Chrome), then snapped
to the real size once the blob URL loaded.

Set inline-size/block-size explicitly via a CSS custom property bound
to the avatarSize prop so the rendered size is locked regardless of
load state or the Bulma reset.
This commit is contained in:
Tink bot 2026-05-18 18:59:35 +00:00 committed by kolaente
parent fee2d2ea58
commit a79517a79a
1 changed files with 3 additions and 0 deletions

View File

@ -2,6 +2,7 @@
<div
class="user"
:class="{'is-inline': isInline}"
:style="{'--avatar-size': `${avatarSize}px`}"
>
<span class="avatar-wrapper">
<img
@ -74,6 +75,8 @@ watch(() => [props.user, props.avatarSize], loadAvatar, { immediate: true })
}
.avatar {
inline-size: var(--avatar-size);
block-size: var(--avatar-size);
border-radius: 100%;
vertical-align: middle;
}