Skip to content

Commit 7311d97

Browse files
committed
✅(frontend) add e2e test for skiplink and fix broken accessibility test
ensures skiplink behavior is tested and stabilizes a failing accessibility test Signed-off-by: Cyril <[email protected]>
1 parent b588541 commit 7311d97

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to
1717
- ♿(frontend) improve ARIA in doc grid and editor for a11y #1519
1818
- ♿(frontend) improve accessibility and styling of summary table #1528
1919
- ♿(frontend) add focus trap and enter key support to remove doc modal #1531
20+
- ♿(frontend) add skip to content button for keyboard accessibility #1624
2021
- 🐛(frontend) preserve @ character when esc is pressed after typing it #1512
2122
- 🐛(frontend) make summary button fixed to remain visible during scroll #1581
2223
- 🐛(frontend) fix pdf embed to use full width #1526

src/frontend/apps/e2e/__tests__/app-impress/header.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,27 @@ test.describe('Header: Override configuration', () => {
176176
await expect(logoImage).toHaveAttribute('alt', '');
177177
});
178178
});
179+
180+
test.describe('Header: Skip to Content', () => {
181+
test('it displays skip link on first TAB and focuses main content on click', async ({
182+
page,
183+
}) => {
184+
await page.goto('/');
185+
186+
// Wait for skip link to be mounted (client-side only component)
187+
const skipLink = page.getByRole('link', { name: 'Go to content' });
188+
await skipLink.waitFor({ state: 'attached' });
189+
190+
// First TAB shows the skip link
191+
await page.keyboard.press('Tab');
192+
193+
// The skip link should be visible and focused
194+
await expect(skipLink).toBeFocused();
195+
await expect(skipLink).toBeVisible();
196+
197+
// Clicking moves focus to the main content
198+
await skipLink.click();
199+
const mainContent = page.locator('main#mainContent');
200+
await expect(mainContent).toBeFocused();
201+
});
202+
});

src/frontend/apps/e2e/__tests__/app-impress/language.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ test.describe('Language', () => {
6666
await page.keyboard.press('Tab');
6767
await page.keyboard.press('Tab');
6868
await page.keyboard.press('Tab');
69+
await page.keyboard.press('Tab');
6970

7071
await page.keyboard.press('Enter');
7172

0 commit comments

Comments
 (0)