integration: compact the wide primary navigation and keep fragment targets visible
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { pagePath } from './helpers';
|
||||
|
||||
test.describe('keyboard and palette', () => {
|
||||
test('skip link is first and moves focus to main', async ({ page }) => {
|
||||
@@ -52,6 +53,40 @@ test.describe('keyboard and palette', () => {
|
||||
expect(await header.evaluate((element) => getComputedStyle(element).position)).not.toBe(
|
||||
'sticky',
|
||||
);
|
||||
|
||||
for (const width of [768, 820, 1024, 1280, 1440]) {
|
||||
await page.setViewportSize({ width, height: 900 });
|
||||
await page.goto('/');
|
||||
expect(
|
||||
await header.evaluate((element) => getComputedStyle(element).position),
|
||||
`header must not be sticky at ${width}px`,
|
||||
).not.toBe('sticky');
|
||||
}
|
||||
});
|
||||
|
||||
test('compact services submenu stays keyboard accessible at 1024px', async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
test.skip(testInfo.project.name === 'mobile', 'compact submenu applies from md up');
|
||||
|
||||
await page.setViewportSize({ width: 1024, height: 900 });
|
||||
await page.goto('/');
|
||||
|
||||
const servicesParent = page.locator(
|
||||
`.primary-nav > li > a[href="${pagePath('services', 'de')}"]`,
|
||||
);
|
||||
const firstChild = page.locator(
|
||||
`.primary-nav > li > .submenu a[href="${pagePath('servicesSoftware', 'de')}"]`,
|
||||
);
|
||||
|
||||
await servicesParent.focus();
|
||||
await expect(firstChild).toBeVisible();
|
||||
await page.keyboard.press('Tab');
|
||||
await expect(firstChild).toBeFocused();
|
||||
|
||||
const headerBox = await page.locator('.site-header').boundingBox();
|
||||
expect(headerBox, 'header while submenu is open').toBeTruthy();
|
||||
expect(headerBox!.height, 'header height while submenu is open').toBeLessThanOrEqual(200);
|
||||
});
|
||||
|
||||
test('palette opens with Control+K, traps focus, locks scroll and restores on Escape', async ({
|
||||
|
||||
Reference in New Issue
Block a user