From e870270fb91cdf33317006ba797396ea468623b8 Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 9 Oct 2026 18:10:30 +0200 Subject: [PATCH] fix(planner): the plan view panel tabs say whether their panel is open and show a focus ring In the plan view the tabs that collapse and reopen the left and right panels gave a screen reader no open or closed state and showed no focus ring when reached with the keyboard. The same tabs in the tour planner had both, because only there LeftPanelTab got the "announced" option, and the plan view's right tab was a hand copy of the left one. LeftPanelTab becomes PanelTab with a side prop and always sets aria-expanded and the focus ring. The plan view's right tab renders it mirrored, so every panel tab shares one component. The offsets are written with literal left and right keys so lint:rtl still counts them. The page shrinks by 11 lines. Red test: FE-PAGE-PLANNER-016b in client/src/pages/TripPlannerPage.test.tsx failed on the old page with expect(element).toHaveAttribute("aria-expanded", "true"). FE-PAGE-PLANNER-LEFTTAB-005 covers the mirrored right tab. Changed assertions (they asserted the missing state): - TripPlannerPage.leftPanelTab.test.tsx FE-PAGE-PLANNER-LEFTTAB-003: not.toHaveAttribute('aria-expanded') and not.toHaveClass ('focus-visible:outline') are now toHaveAttribute('aria-expanded', 'true') and toHaveClass('focus-visible:outline') (title updated). - TripPlannerPage.leftPanelTab.test.tsx FE-PAGE-PLANNER-LEFTTAB-004: the "announced" prop is dropped from both renders (title updated); the expectations are unchanged. The file renders PanelTab instead of LeftPanelTab. --- client/scripts/size-baseline.json | 2 +- .../TripPlannerPage.leftPanelTab.test.tsx | 42 +++++++++++----- client/src/pages/TripPlannerPage.test.tsx | 24 +++++++++ client/src/pages/TripPlannerPage.tsx | 50 ++++++++----------- 4 files changed, 76 insertions(+), 42 deletions(-) diff --git a/client/scripts/size-baseline.json b/client/scripts/size-baseline.json index 185f4cd1a..688069e45 100644 --- a/client/scripts/size-baseline.json +++ b/client/scripts/size-baseline.json @@ -24,7 +24,7 @@ "src/mobile/screens/admin/MAdminPluginsPanel.tsx": 1507, "src/pages/JourneyDetailPage.test.tsx": 4030, "src/pages/LoginPage.tsx": 1348, - "src/pages/TripPlannerPage.tsx": 1179, + "src/pages/TripPlannerPage.tsx": 1168, "src/pages/TripPlannerPage.wiring.test.tsx": 2049, "src/pages/atlas/useAtlas.ts": 1287, "src/pages/tripPlanner/useTripPlanner.roadtrip.test.tsx": 3531, diff --git a/client/src/pages/TripPlannerPage.leftPanelTab.test.tsx b/client/src/pages/TripPlannerPage.leftPanelTab.test.tsx index 0e7806e9d..b79b9505f 100644 --- a/client/src/pages/TripPlannerPage.leftPanelTab.test.tsx +++ b/client/src/pages/TripPlannerPage.leftPanelTab.test.tsx @@ -2,14 +2,14 @@ import { fireEvent, screen } from '@testing-library/react'; import { describe, expect, it, vi } from 'vitest'; import { render } from '../../tests/helpers/render'; -import { LeftPanelTab } from './TripPlannerPage'; +import { PanelTab } from './TripPlannerPage'; -// FE-PAGE-PLANNER-LEFTTAB-001 to FE-PAGE-PLANNER-LEFTTAB-004 +// FE-PAGE-PLANNER-LEFTTAB-001 to FE-PAGE-PLANNER-LEFTTAB-005 -describe('LeftPanelTab', () => { +describe('PanelTab', () => { it('FE-PAGE-PLANNER-LEFTTAB-001: an open panel shows a flap on its edge that collapses it', () => { const onToggle = vi.fn(); - render(