Skip to content

FIX: improve frontend accessibility and mobile responsiveness#2240

Open
romanlutz wants to merge 1 commit into
microsoft:mainfrom
romanlutz:romanlutz-fix-frontend-a11y-responsive
Open

FIX: improve frontend accessibility and mobile responsiveness#2240
romanlutz wants to merge 1 commit into
microsoft:mainfrom
romanlutz:romanlutz-fix-frontend-a11y-responsive

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

The July 21 exploratory audit found that the onboarding tour became unusable on a 390px viewport, several major views lacked heading and navigation semantics, the target-type filter had no accessible name, and key mobile controls fell below a 44px touch target. This change resolves those findings while preserving the existing Fluent UI design, desktop density, dark mode, and tour navigation behavior.

  • Keeps every tour step inside the viewport by combining Floating UI cross-axis shifting with a viewport-bounded tooltip, wrapping actions, and a contained mascot treatment.
  • Adds one page-level heading to Home, Attack History, Target Configuration, and Chat, plus a labeled primary navigation landmark and current-page semantics.
  • Associates Filter by type: with its native select through stable semantic label wiring.
  • Applies mobile-only 44px minimum hit areas to the audited Home, Configuration, and tour controls without expanding their desktop layout.
  • Adds focused unit and Playwright coverage for semantics, accessible naming, settled tour geometry, horizontal overflow, action visibility, and measured touch-target dimensions.

Visual comparison (390x844)

Onboarding tour

Before After
Before: onboarding tour clipped beyond the mobile viewport After: onboarding tour contained within the mobile viewport

Home controls and responsive containment

Before After
Before: Home controls at the mobile edge After: Home content and controls contained on mobile

Configuration actions

Before After
Before: compact Configuration mobile actions After: Configuration actions with 44px mobile hit areas

The heading, navigation landmark, current-page, and filter-label changes are intentionally not visually apparent.

Tests and Documentation

  • Targeted Jest: 7 suites, 186 tests passed for Home, Attack History, Target Configuration, TargetTable, ChatWindow, Navigation, and useTour.
  • TourTooltip Jest: 1 suite, 12 tests passed.
  • Playwright mock project: 12 tests passed in e2e/accessibility.spec.ts, including every tour step at 390x844 and 1280x800 after positioning settles.
  • npm run type-check passed.
  • ESLint passed with zero warnings across all changed frontend files.
  • npm run build passed (tsc && vite build).
  • Documentation changes: N/A. JupyText: N/A.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e4044304-01aa-420b-97f3-b3b2c5962922
Copilot AI review requested due to automatic review settings July 21, 2026 18:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the frontend’s accessibility semantics and mobile responsiveness, primarily focusing on the onboarding tour staying within small viewports, adding page-level heading/navigation landmarks, wiring an accessible label to the target-type filter, and enforcing mobile touch-target sizing with accompanying Jest + Playwright coverage.

Changes:

  • Refines Joyride/Floating UI tour positioning options and makes the tour tooltip layout more viewport-safe on mobile.
  • Adds page-level heading semantics across major views and a labeled primary navigation landmark with aria-current="page".
  • Ensures key audited controls meet 44px mobile hit targets and expands unit/E2E coverage for a11y + responsive behavior.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
frontend/src/hooks/useTour.ts Adds cross-axis shifting + viewport padding for Joyride tooltip positioning.
frontend/src/hooks/useTour.test.ts Asserts the new Joyride floating options shape is applied.
frontend/src/components/Tour/TourTooltip.tsx Refactors tooltip structure, adds test id, and applies button classes for mobile hit targets.
frontend/src/components/Tour/TourTooltip.styles.ts Constrains tooltip width on small viewports, wraps actions, and enforces 44px touch targets for tooltip controls.
frontend/src/components/Sidebar/Navigation.tsx Introduces a primary <nav> landmark and aria-current for the active view.
frontend/src/components/Sidebar/Navigation.test.tsx Tests navigation landmark presence and current-page semantics.
frontend/src/components/Sidebar/Navigation.styles.ts Adds styles for the new primary navigation wrapper.
frontend/src/components/Layout/MainLayout.tsx Adds a class hook for mobile sizing of the “Take a tour” button.
frontend/src/components/Layout/MainLayout.styles.ts Enforces 44px min-height for the tour button on mobile.
frontend/src/components/Labels/LabelsBar.styles.ts Enforces 44px min-height for audited icon buttons on mobile.
frontend/src/components/Home/Home.tsx Adds heading semantics (h1/h2/h3) and a mobile hit-target class for the primary action.
frontend/src/components/Home/Home.test.tsx Updates assertions to validate heading roles/levels.
frontend/src/components/Home/Home.styles.ts Improves mobile padding/containment and enforces 44px min-height for primary action.
frontend/src/components/History/AttackHistory.tsx Adds an h1 heading for Attack History.
frontend/src/components/History/AttackHistory.test.tsx Updates assertions to validate the h1 heading.
frontend/src/components/Config/TargetTable.tsx Wires a semantic label to the type filter via useId + htmlFor/id.
frontend/src/components/Config/TargetTable.test.tsx Updates the combobox query to require the accessible name.
frontend/src/components/Config/TargetConfig.tsx Adds an h1 heading for Target Configuration.
frontend/src/components/Config/TargetConfig.test.tsx Adds a heading-role assertion for Target Configuration.
frontend/src/components/Config/TargetConfig.styles.ts Enforces 44px min-height for header actions on mobile.
frontend/src/components/Chat/ChatWindow.tsx Adds a (visually hidden) page-level h1 heading for Chat.
frontend/src/components/Chat/ChatWindow.test.tsx Asserts Chat exposes a level-1 heading.
frontend/src/components/Chat/ChatWindow.styles.ts Adds visually-hidden heading styles.
frontend/e2e/accessibility.spec.ts Adds E2E assertions for headings/landmarks, tour containment, overflow checks, and touch-target dimensions.

Comment on lines 42 to 48
<Button
{...closeProps}
appearance="subtle"
icon={<DismissRegular />}
size="small"
className={styles.closeButton}
/>
Comment on lines +65 to 69
<Button {...skipProps} appearance="subtle" size="small" className={styles.actionButton}>
Skip tour
</Button>
)}

Comment on lines +25 to +38
const box = await dialog.boundingBox();
const viewport = page.viewportSize();
const dimensions = await page.evaluate(() => ({
clientWidth: document.documentElement.clientWidth,
scrollWidth: document.documentElement.scrollWidth,
}));

return (
box !== null &&
viewport !== null &&
box.x >= 0 &&
box.x + box.width <= viewport.width + 1 &&
dimensions.scrollWidth <= dimensions.clientWidth + 1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants