Repository navigation
fix(Typeahead): dismiss the result list on the Tab keydown, not on the blur - #5400
Merged
Merged
Conversation
…e blur Closing the popover from the blur that Tab produces hides a top-layer popover mid-navigation, which Chrome answers by abandoning the in-flight focus move and dropping focus to <body>. useFocusTrap's restore-on-deactivate then correctly repairs <body> by returning focus to the input, so the user's Tab appears to do nothing at all. Selector and MultiSelector already dismiss on this keydown. The blur handler stays as the safety net for programmatic focus moves.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cixzhang
enabled auto-merge (squash)
August 24, 2026 05:22
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsTypeahead (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A keyboard user types in a
Typeahead, presses Tab to move to the next control, and nothing happens. The caret stays in the field.Measured in Chromium,
core-typeahead--default, againstmainafter #5397:Tab is not being cancelled any more — #5397 fixed that. Focus genuinely leaves, and then comes straight back. Traced:
focusoutfires on the input withrelatedTarget= the next control.BaseTypeahead.handleBlurcallspopover.hide()inside that focusout.<body>and never reaches the next control.useFocusTrap's restore-on-deactivate sees<body>, correctly concludes focus was lost, and returns it to the input.Every step is doing its job. The timing is the defect.
Solution
Dismiss on the Tab keydown, before the browser moves anything — which is what
Selector.tsx:1191andMultiSelector.tsx:1270already do, and whatDateTimeInput.tsx:1316does for its time list.The blur handler stays untouched as the safety net for programmatic focus moves, which is what its docblock says it is for.
Verification
Real Chromium, same probe, same story, single variable — only this hunk reverted for the BEFORE row:
SB_PORT=6522 node ~/astryx/probe-kit/focus-trap-tab-passthrough.cjsSelectorandMultiSelectormeasured alongside as controls:moved=trueon both rows, unchanged.Tests
closes the list on the Tab keydown, before the blur it produces— fires the keydown with no blur, so it fails if the dismissal moves back intohandleBlur. Verified 1 failed / 55 passed without the fix, 56 passed with it.jsdom cannot reproduce the Chrome focus-abandon itself, so the browser evidence above is the claim and the test is the guard.
Breaking