Files
SluijsensandClaude Opus 5.5 b332f1a846
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
Announces pausing and resuming the hero slide show
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>
2026-10-19 20:33:47 +02:00

62 lines
2.5 KiB
JavaScript

// Reproductie en verificatie (headless Chrome): meldt de Hero een wissel door
// de bezoeker, blijft hij stil bij een automatische wissel, en is er een
// pauzeknop die werkt?
// Gebruik: node hero-repro.mjs <file-URL van puppeteer-core.js> [url]
const { default: puppeteer } = await import(process.argv[2]);
const url = process.argv[3] ?? 'https://test.andreaslop.nl/';
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
const browser = await puppeteer.launch({
executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe',
headless: true,
});
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle0' });
// Muis buiten de hero, anders pauzeert hover de slider
await page.mouse.move(0, 0);
const live = () =>
page.$$eval('section[aria-roledescription="carousel"] [aria-live]', (els) =>
els.map((e) => `${e.getAttribute('aria-live')}: "${e.textContent.trim()}"`),
);
const slide = () =>
page.$eval(
'[aria-roledescription="slide"]:not([aria-hidden="true"])',
(e) => e.getAttribute('aria-label'),
);
const buttons = async () => {
const snap = await page.accessibility.snapshot({ interestingOnly: true });
const names = [];
(function walk(n) {
if (n.role === 'button') names.push(n.name);
(n.children || []).forEach(walk);
})(snap);
return names;
};
console.log('1. voor klik | slide:', await slide(), '| live:', JSON.stringify(await live()));
await page.click('[data-testid="hero-next-button"]');
await wait(500);
console.log('2. na pijlklik | slide:', await slide(), '| live:', JSON.stringify(await live()));
await page.mouse.move(0, 0);
await wait(7000);
console.log('3. na autoplay | slide:', await slide(), '| live:', JSON.stringify(await live()));
console.log('4. knoppen |', JSON.stringify(await buttons()));
const pause = await page.$('[data-testid="hero-pause-button"]');
if (pause) {
await pause.click();
await page.mouse.move(0, 0);
const before = await slide();
await wait(7000);
console.log('5. gepauzeerd | slide blijft:', before, '->', await slide(), '| live:', JSON.stringify(await live()), '| knoppen:', JSON.stringify(await buttons()));
await pause.click();
await wait(300);
console.log('6a. na afspelen | live:', JSON.stringify(await live()));
await page.mouse.move(0, 0);
await wait(7000);
console.log('6. hervat | slide nu:', await slide(), '| knoppen:', JSON.stringify(await buttons()));
} else {
console.log('5. geen pauzeknop');
}
await browser.close();