Specify lazy loading for avatars (#10866)
* Specify lazy loading for avatars so browser doesn't fetch eagerly if off-screen * Update snapshots
This commit is contained in:
parent
73007d6dd6
commit
2cee8a4b01
19 changed files with 44 additions and 4 deletions
|
@ -199,7 +199,7 @@ describe("<TextualBody />", () => {
|
|||
const { container } = getComponent({ mxEvent: ev });
|
||||
const content = container.querySelector(".mx_EventTile_body");
|
||||
expect(content.innerHTML).toMatchInlineSnapshot(
|
||||
`"Chat with <span><bdi><a class="mx_Pill mx_UserPill mx_UserPill_me" href="https://matrix.to/#/@user:example.com" aria-describedby="mx_Pill_0.123456"><img class="mx_BaseAvatar mx_BaseAvatar_image" src="mxc://avatar.url/image.png" style="width: 16px; height: 16px;" alt="" data-testid="avatar-img" aria-hidden="true"><span class="mx_Pill_text">Member</span></a></bdi></span>"`,
|
||||
`"Chat with <span><bdi><a class="mx_Pill mx_UserPill mx_UserPill_me" href="https://matrix.to/#/@user:example.com" aria-describedby="mx_Pill_0.123456"><img loading="lazy" class="mx_BaseAvatar mx_BaseAvatar_image" src="mxc://avatar.url/image.png" style="width: 16px; height: 16px;" alt="" data-testid="avatar-img" aria-hidden="true"><span class="mx_Pill_text">Member</span></a></bdi></span>"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ exports[`MLocationBody <MLocationBody> without error renders marker correctly fo
|
|||
aria-hidden="true"
|
||||
class="mx_BaseAvatar_image"
|
||||
data-testid="avatar-img"
|
||||
loading="lazy"
|
||||
src="data:image/png;base64,00"
|
||||
style="width: 36px; height: 36px;"
|
||||
title="@user:server"
|
||||
|
|
|
@ -59,6 +59,7 @@ exports[`<TextualBody /> renders formatted m.text correctly pills appear for an
|
|||
aria-hidden="true"
|
||||
class="mx_BaseAvatar mx_BaseAvatar_image"
|
||||
data-testid="avatar-img"
|
||||
loading="lazy"
|
||||
src="mxc://avatar.url/image.png"
|
||||
style="width: 16px; height: 16px;"
|
||||
/>
|
||||
|
@ -95,6 +96,7 @@ exports[`<TextualBody /> renders formatted m.text correctly pills appear for eve
|
|||
aria-hidden="true"
|
||||
class="mx_BaseAvatar mx_BaseAvatar_image"
|
||||
data-testid="avatar-img"
|
||||
loading="lazy"
|
||||
src="mxc://avatar.url/room.png"
|
||||
style="width: 16px; height: 16px;"
|
||||
/>
|
||||
|
@ -133,6 +135,7 @@ exports[`<TextualBody /> renders formatted m.text correctly pills appear for roo
|
|||
aria-hidden="true"
|
||||
class="mx_BaseAvatar mx_BaseAvatar_image"
|
||||
data-testid="avatar-img"
|
||||
loading="lazy"
|
||||
src="mxc://avatar.url/room.png"
|
||||
style="width: 16px; height: 16px;"
|
||||
/>
|
||||
|
@ -230,6 +233,7 @@ exports[`<TextualBody /> renders formatted m.text correctly pills get injected c
|
|||
aria-hidden="true"
|
||||
class="mx_BaseAvatar mx_BaseAvatar_image"
|
||||
data-testid="avatar-img"
|
||||
loading="lazy"
|
||||
src="mxc://avatar.url/image.png"
|
||||
style="width: 16px; height: 16px;"
|
||||
/>
|
||||
|
@ -253,6 +257,7 @@ exports[`<TextualBody /> renders plain-text m.text correctly should pillify a pe
|
|||
href="https://matrix.to/#/!room1:example.com/%event_id%"
|
||||
aria-describedby="mx_Pill_0.123456"
|
||||
><img
|
||||
loading="lazy"
|
||||
class="mx_BaseAvatar mx_BaseAvatar_image"
|
||||
src="mxc://avatar.url/image.png"
|
||||
style="width: 16px; height: 16px"
|
||||
|
@ -275,6 +280,7 @@ exports[`<TextualBody /> renders plain-text m.text correctly should pillify a pe
|
|||
href="https://matrix.to/#/!room2:example.com/%event_id%"
|
||||
aria-describedby="mx_Pill_0.123456"
|
||||
><img
|
||||
loading="lazy"
|
||||
class="mx_BaseAvatar mx_BaseAvatar_image"
|
||||
src="mxc://avatar.url/room.png"
|
||||
style="width: 16px; height: 16px"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue