Repository navigation
fix TreeView typeahead when nested controls have focus - #8524
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🦋 Changeset detectedLatest commit: c3a84ae The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
|
Integration test results from github/github-ui PR:
All checks passed! |
There was a problem hiding this comment.
🟢 Approval recommended
The focused guard and regression coverage show no blocking issues; tests were reviewed but not executed.
0 open findings
What changed in this PR
Fixes TreeView typeahead so typing in nested controls does not trigger searches or steal focus, while preserving normal tree-item searches.
Changes:
- Restricts typeahead handling to events originating on tree items.
- Adds regression tests for nested buttons, inputs, and search-buffer preservation.
- Adds a patch changeset.
| File | Description |
|---|---|
| packages/react/src/TreeView/useTypeahead.ts | Ignores nested-control keystrokes. |
| packages/react/src/TreeView/TreeView.test.tsx | Covers nested controls and continued searches. |
| .changeset/treeview-typeahead-nested-controls.md | Documents the patch fix. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Closes github/primer#6402
Typing in a nested TreeView control can crash typeahead or steal focus. Restrict typeahead to keystrokes originating on tree items so nested controls retain their keyboard behavior without changing the public API or normal tree-item searches.
Changelog
Changed
Rollout strategy
Testing & Reviewing
Click a reorder button in the TreeView Leading Action story, then type
zzquickly. This should no longer produce the matching stack:getAccessibleName → useTypeahead → onKeyDown. If you do this against the prod storybook you'll see the original error we're fixing here.Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com