Announces pausing and resuming the hero slide show
Continuous Integration / check (pull_request) Successful in 6m47s
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 3m47s
Continuous Integration / deploy-production (pull_request) Skipped

The pause button only changed its name, which screen readers often do not read
for the focused button. The live region now also says when the slide show is
paused or plays again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 20:33:47 +02:00
co-authored by Claude Opus 5.5
parent e308aad8f0
commit b332f1a846
7 changed files with 68 additions and 18 deletions
+20 -6
View File
@@ -11,12 +11,25 @@ import LinkButton from '../LinkButton';
import HeroArrows from './HeroArrows';
import HeroPauseButton from './HeroPauseButton';
import HeroSocials from './HeroSocials';
import useHeroSlider from './useHeroSlider';
import useHeroSlider, { type HeroAnnouncement } from './useHeroSlider';
import type { HeroContent, SocialLink } from '@/content/types';
import { slidesToLoad } from '@/lib/slidesToLoad';
const SLIDE_DURATION = '6s';
function announcementText(announcement: HeroAnnouncement, slide: string) {
switch (announcement) {
case 'slide':
return slide;
case 'paused':
return 'Diavoorstelling gepauzeerd';
case 'playing':
return 'Diavoorstelling speelt weer af';
default:
return '';
}
}
type HeroProps = {
content: HeroContent;
socials: SocialLink[];
@@ -26,7 +39,7 @@ export default function Hero({ content, socials }: HeroProps) {
const { title, tagline, cta, slides } = content;
const {
active,
announce,
announcement,
reducedMotion,
autoplay,
paused,
@@ -152,7 +165,7 @@ export default function Hero({ content, socials }: HeroProps) {
<HeroPauseButton stopped={stopped} onToggle={toggleStopped} />
)}
{/* Meldt een wissel door de bezoeker; staat er altijd, want een
{/* Meldt een wissel of pauze door de bezoeker; staat er altijd, want een
live-gebied moet al bestaan voordat de tekst verandert. Leeg na
een automatische wissel, zodat er geen oude melding blijft. */}
<VisuallyHidden
@@ -160,9 +173,10 @@ export default function Hero({ content, socials }: HeroProps) {
aria-atomic="true"
data-testid="hero-announcement"
>
{announce
? `Foto ${active + 1} van ${slides.length}: ${slides[active].alt}`
: ''}
{announcementText(
announcement,
`Foto ${active + 1} van ${slides.length}: ${slides[active].alt}`,
)}
</VisuallyHidden>
{/* Voortgangsbalk: als de animatie klaar is, schuift de slider door.