Skip to content

fix(html-reporter): add keyboard navigation to TabbedPane component#41042

Open
padmarajnidagundi wants to merge 1 commit into
microsoft:mainfrom
padmarajnidagundi:fix/tabbed-pane-keyboard-navigation
Open

fix(html-reporter): add keyboard navigation to TabbedPane component#41042
padmarajnidagundi wants to merge 1 commit into
microsoft:mainfrom
padmarajnidagundi:fix/tabbed-pane-keyboard-navigation

Conversation

@padmarajnidagundi
Copy link
Copy Markdown

Summary

Fixes #41005 — the TabbedPane component in the HTML reporter and trace viewer was missing keyboard navigation, making it inaccessible to keyboard-only users and screen readers.

Changes

Both packages/html-reporter/src/tabbedPane.tsx and packages/web/src/components/tabbedPane.tsx now implement the ARIA Tabs keyboard interaction pattern:

Key Behavior
ArrowRight Move focus to next tab (wraps around)
ArrowLeft Move focus to previous tab (wraps around)
Home Move focus to first tab
End Move focus to last tab

Additionally, tabs now use the roving tabIndex pattern — the selected tab has tabIndex={0} and all others have tabIndex={-1}, so Tab key enters the tablist at the currently-selected tab.

Implementation Notes

  • Keyboard handler is placed on the role="tablist" container for clean event delegation
  • Uses document.activeElement to find the focused tab index, avoiding stale closure issues
  • e.preventDefault() is called on handled keys to prevent page scroll on Arrow/Home/End keys
  • No dependency changes; pure React/DOM fix

Add WCAG 2.1 compliant keyboard navigation to TabbedPane in the HTML
reporter and trace viewer. Previously, the tab components only responded
to mouse clicks, preventing keyboard-only and screen reader users from
navigating between tabs.

- Add Arrow Right/Left to move focus between tabs
- Add Home/End to jump to first/last tab
- Use roving tabIndex pattern (0 for selected tab, -1 for others)

Fixes microsoft#41005
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.

[Bug]: Missing Keyboard Navigation in TabbedPane Component

1 participant