From d729c899d04b2604f6f018f64f4c534092f5cf14 Mon Sep 17 00:00:00 2001 From: khaira777 <777gurkirat@gmail.com> Date: Wed, 14 Oct 2026 20:10:06 -0400 Subject: [PATCH 1/3] fix(a11y): add primary navigation landmark Fixes #1097 --- frontend/e2e/layout-integrity.spec.ts | 125 +++++++++++++++++++++ frontend/src/components/layout/Sidebar.tsx | 52 ++++----- 2 files changed, 152 insertions(+), 25 deletions(-) diff --git a/frontend/e2e/layout-integrity.spec.ts b/frontend/e2e/layout-integrity.spec.ts index d527fc6fe..e46f3ac3c 100644 --- a/frontend/e2e/layout-integrity.spec.ts +++ b/frontend/e2e/layout-integrity.spec.ts @@ -300,6 +300,131 @@ test('sidebar theme toggle button does not clip horizontally or vertically acros } }); +test('sidebar renders one localized primary navigation landmark wrapping nav links and excluding non-navigation controls across desktop, collapsed, keyboard, RTL, and mobile states (#1097)', async ({ + page, +}) => { + await page.goto(`${BASE}/auth/login`); + await page.locator('#email').fill('owner@flo.local'); + await page.locator('#password').fill(E2E_PASSWORD); + await page.locator('button[type="submit"]').click(); + await page.waitForURL(/\/pos/, { timeout: 20000 }); + + try { + await setLanguage(page, 'en'); + await page.goto(`${BASE}/orders`); + + const sidebar = page.locator('[data-slot="sidebar"]'); + await expect(sidebar).toHaveAttribute('data-state', 'expanded'); + + // Desktop expanded (LTR): exactly one navigation landmark with localized label + await expect(page.getByRole('navigation')).toHaveCount(1); + const primaryNav = page.getByRole('navigation', { name: 'Menu', exact: true }); + await expect(primaryNav).toBeVisible(); + expect(await primaryNav.evaluate((el) => el.tagName)).toBe('NAV'); + + const expectedLinks = [ + 'POS', + 'Dashboard', + 'Orders', + 'Products', + 'Inventory', + 'Expenses', + 'Customers', + 'Staff', + 'Settings', + ]; + for (const label of expectedLinks) { + await expect( + primaryNav.getByRole('link', { name: label, exact: true }), + `desktop expanded nav contains link "${label}"`, + ).toBeVisible(); + } + + // Header brand link, theme toggle, user profile menu, and resize rail stay outside