Hero: slow zoom on the first photo without replacing the plain HTML
Continuous Integration / check (pull_request) Successful in 1m57s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 9m0s
Continuous Integration / deploy-production (pull_request) Skipped

The plain HTML is painted at scale 1.06 and the slider zooms it out to 1
after hydration, like the other photos: same first frame (no CLS), and the
LCP does not wait for hydration. Assumptions 15 and 16 recorded.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 10:31:22 +01:00
co-authored by Claude Sonnet 5.5
parent 20806692bb
commit 8050072ce5
4 changed files with 59 additions and 19 deletions
+18
View File
@@ -135,6 +135,24 @@ describe('Hero', () => {
});
});
it('laat de eerste foto inzoomen zolang hij de actieve is', async () => {
const { container } = await renderWithProviders(
<Hero content={heroContent} socials={siteContent.socials} />,
);
const picture = container.querySelector('.cms-hero-picture')!;
expect(picture).toHaveAttribute('data-zoom');
expect(picture).not.toHaveAttribute('aria-hidden');
await userEvent.click(
screen.getByRole('button', { name: 'Volgende foto' }),
);
expect(picture).not.toHaveAttribute('data-zoom');
expect(picture).toHaveAttribute('aria-hidden', 'true');
await userEvent.click(
screen.getByRole('button', { name: 'Vorige foto' }),
);
expect(picture).toHaveAttribute('data-zoom');
});
it('heeft pijlen met een toegankelijke naam', async () => {
await renderWithProviders(
<Hero content={heroContent} socials={siteContent.socials} />,
+9 -3
View File
@@ -164,11 +164,17 @@ function HeroFrame({ content, socials, regionHtml, hydrated }: FrameProps) {
}, [firstPainted]);
// The first photo is hidden from screen readers while another one is on
// top of it
// top of it, and it zooms (data-zoom, see .cms-hero-image) while it is the
// active one
useEffect(() => {
const picture = section.current?.querySelector('.cms-hero-picture');
if (active === 0) picture?.removeAttribute('aria-hidden');
else picture?.setAttribute('aria-hidden', 'true');
if (active === 0) {
picture?.removeAttribute('aria-hidden');
picture?.setAttribute('data-zoom', '');
} else {
picture?.setAttribute('aria-hidden', 'true');
picture?.removeAttribute('data-zoom');
}
}, [active]);
const loaded = firstPainted ? slidesToLoad(active, shown.length) : [active];