Skip to content

fix TreeView typeahead when nested controls have focus - #8524

Merged
tay1orjones merged 2 commits into
mainfrom
tay1orjones-primer-issue-investigation
Oct 19, 2026
Merged

tay1orjones merged 2 commits into
mainfrom
tay1orjones-primer-issue-investigation

Conversation

@tay1orjones

@tay1orjones tay1orjones commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

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

  • TreeView ignores nested-control keystrokes before updating its typeahead search buffer.

Rollout strategy

  • No changes needed in github/github-ui
  • Needs changes in github/github-ui
  • Ships with feature flag(s)
  • Not sure
  • None

Testing & Reviewing

Click a reorder button in the TreeView Leading Action story, then type zz quickly. 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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c3a84ae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions
github-actions Bot temporarily deployed to storybook-preview-8524 October 7, 2026 22:51 Inactive
@github-actions github-actions Bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 7, 2026
@primer primer deleted a comment from primer-integration Bot Oct 14, 2026
@tay1orjones tay1orjones removed the integration-tests: failing Changes in this PR cause breaking changes in gh/gh label Oct 14, 2026
@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions
github-actions Bot temporarily deployed to storybook-preview-8524 October 14, 2026 16:42 Inactive
@github-actions github-actions Bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm integration-tests: failing Changes in this PR cause breaking changes in gh/gh labels Oct 14, 2026
@tay1orjones
tay1orjones marked this pull request as ready for review October 14, 2026 19:32
@tay1orjones
tay1orjones requested a review from a team as a code owner October 14, 2026 19:32
@tay1orjones
tay1orjones requested review from siddharthkp and a balanced review from Copilot October 14, 2026 19:32
@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  Changes   Passed
Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

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.

🟢 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.

@tay1orjones
tay1orjones added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit 0d5607c Oct 19, 2026
57 checks passed
@tay1orjones
tay1orjones deleted the tay1orjones-primer-issue-investigation branch October 19, 2026 16:07
@primer primer Bot mentioned this pull request Oct 19, 2026

This branch was successfully deployed

1 active and 1 inactive deployments
storybook-preview-8524 — c3a84ae3 Deployed Oct 14, 2026 by github-actions[bot]
github-pages — c3a84ae3 Deployed Oct 14, 2026 by tay1orjones via deploy-preview #33685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants