Skip to content

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

Merged
pavelfeldman merged 1 commit into
microsoft:mainfrom
padmarajnidagundi:fix/tabbed-pane-keyboard-navigation
May 30, 2026
Merged

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

Conversation

@padmarajnidagundi

Copy link
Copy Markdown
Contributor

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
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7207 passed, 1113 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 flaky ⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`

43971 passed, 864 skipped


Merge workflow run.

@pavelfeldman pavelfeldman merged commit 3edc77f into microsoft:main May 30, 2026
47 checks passed
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

2 participants