Skip to content

Commit 46a87ac

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 cbb5c79 commit 46a87ac

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-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
- 🐛(docx) fix image overflow by limiting width to 600px during export #1525
2122
- 🐛(frontend) preserve @ character when esc is pressed after typing it #1512
2223
- 🐛(frontend) make summary button fixed to remain visible during scroll #1581

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,24 @@ 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+
// First TAB shows the skip link
187+
await page.keyboard.press('Tab');
188+
189+
// The skip link should be visible and focused
190+
const skipLink = page.getByRole('link', { name: 'Go to content' });
191+
await expect(skipLink).toBeFocused();
192+
await expect(skipLink).toBeVisible();
193+
194+
// Clicking moves focus to the main content
195+
await skipLink.click();
196+
const mainContent = page.locator('main#mainContent');
197+
await expect(mainContent).toBeFocused();
198+
});
199+
});

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)