From 5aa4da87f4f20f56f7da6f0b7454d72eaf6f57ac Mon Sep 17 00:00:00 2001 From: poli0981 <127664709+poli0981@users.noreply.github.com> Date: Tue, 10 Nov 2026 19:18:49 +0700 Subject: [PATCH] fix(a11y): five defects found by driving the installed build Every one of these was in code whose tests were green. They were found by installing the bundle, opening WebView2's debugging port, and pressing real keys while reading document.activeElement and the accessibility tree. - The high-contrast border on destructive buttons had never been drawn. The rule sat in @layer base; every button carries Tailwind's border utility, a later layer wins whatever the selectors say, and border: 2px lost to border-width: 1px. It is outside every layer, and a double border, because 2px beside 1px is not a difference anyone sees. - Accepting the legal gate left focus on nothing: the gate is rendered instead of the shell, so the screen was replaced with the tab unchanged. - A button that disabled itself when pressed dropped focus to , because a browser takes focus from a control that becomes disabled and jsdom does not. Use, Rescan, Run, Run audit, Add, Download the index, Stop and the two requirements buttons are aria-disabled while busy and ignore a second press. - A dialog's name read "Remove packages : certifi": a browser puts a space before visually-hidden text. The second half of the name is an aria-label. - The Updates tab's name read "Updates(5)". Zoom hotkeys were tried and are not in this commit: at 200% in the default window the package-name column collapsed to zero width. Co-Authored-By: Claude Fable 5.2 --- ui/src/App.test.tsx | 20 +++++++++ ui/src/App.tsx | 5 ++- ui/src/components/PdDialog.tsx | 12 +++-- ui/src/components/PdRequirements.tsx | 16 ++++--- ui/src/components/PdSidebar.tsx | 5 ++- ui/src/components/PdUninstallDialog.test.tsx | 3 +- ui/src/destructive.test.ts | 17 +++++++ ui/src/screens/PdEnvironments.tsx | 15 ++++--- ui/src/screens/PdHealth.tsx | 9 ++-- ui/src/screens/PdPlanPanel.tsx | 9 ++-- ui/src/screens/PdSearch.test.tsx | 47 +++++++++++++++++++- ui/src/screens/PdSearch.tsx | 15 ++++--- ui/src/screens/PdSecurity.test.tsx | 6 ++- ui/src/screens/PdSecurity.tsx | 9 ++-- ui/src/styles.css | 32 +++++++++---- 15 files changed, 174 insertions(+), 46 deletions(-) diff --git a/ui/src/App.test.tsx b/ui/src/App.test.tsx index 7462735..4c296cc 100644 --- a/ui/src/App.test.tsx +++ b/ui/src/App.test.tsx @@ -264,6 +264,26 @@ describe('where focus goes when the screen is replaced', () => { }) }) + it('lands on the first screen when the legal gate is accepted', async () => { + // Found in the installed build: *Continue* is unmounted with the gate, the shell appears + // behind it, and the tab has not changed — so the very first screen of a first run had focus + // on nothing. + legalConsentGet.mockResolvedValue({ current: false, docsHash: 'a1b2c3d4e5f60718' }) + useLegalStore.setState({ accepted: false, review: false }) + render() + const accept = await screen.findByRole('button', { name: 'Continue' }) + accept.focus() + + act(() => { + useLegalStore.setState({ accepted: true }) + }) + + await waitFor(() => { + expect(heading()).toHaveFocus() + }) + expect(heading()).toHaveTextContent('Installed') + }) + it('does not take focus from a control that is still there', async () => { // The rule is "focus was lost", not "the phase changed": moving it on every phase would pull // a keyboard user off *Console* each time a run advanced. diff --git a/ui/src/App.tsx b/ui/src/App.tsx index c4feb3c..d057592 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -154,7 +154,10 @@ export function App() { if (target === null || target === undefined) return if (target.tagName === 'H1') target.setAttribute('tabindex', '-1') target.focus() - }, [panelPhase, depsOpen, envOpen]) + // `accepted` and `review`: the legal gate is rendered *instead of* the shell, so accepting it + // or closing a review is a fifth way the screen is replaced with `nav` unchanged — and the + // first screen of a first run had focus on nothing. Found in the installed build. + }, [panelPhase, depsOpen, envOpen, accepted, review]) // UI-SPEC §8: Ctrl+1..9 select tabs, positionally over NAV_KEYS. useEffect(() => { diff --git a/ui/src/components/PdDialog.tsx b/ui/src/components/PdDialog.tsx index 5518926..7e65cf8 100644 --- a/ui/src/components/PdDialog.tsx +++ b/ui/src/components/PdDialog.tsx @@ -81,9 +81,14 @@ export function PdDialog({ return (