Repository navigation
test(DropdownMenu): pin the focus ring returning with the keyboard - #6901
Conversation
#6825 made a pointer dismissal return focus to the trigger with the ring suppressed. The suppression belongs to that pointer, not to the trigger, so a keyboard user who tabs away and back must get the ring again — the trigger's own onFocus clears the suppression once the modality is keyboard. No test covered that second half: deleting the onFocusReturnTargetFocus call left all 108 DropdownMenu tests green. This adds the assertion. Verified as a real guard by removing both call sites, which fails exactly this case. Test-only; no runtime change and no changeset.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Thanks for pinning this down. The new case covers the previously untested half of the pointer-pick behavior: suppression is confirmed after the mouse pick, then cleared once keyboard input brings focus back to the trigger, which matches the shared rule that the focus indicator follows the last input modality.
I ran the touched test file locally: all 109 tests pass, including the new case on its own, and formatting and lint pass for the file. This is a test-only change with no API or runtime behavior change, and I found no blocking issues.
[Automated review]
What this fixes
#6825 made a pointer dismissal return focus to the DropdownMenu trigger with the focus ring suppressed, so a mouse user keeps their place without being handed a keyboard-only ring.
The suppression belongs to the pointer that dismissed the menu, not to the trigger. A keyboard user who tabs away and comes back is asking to see where they are, so the ring has to return — the trigger's own
onFocusclears the suppression once the modality is keyboard again.That second half had no test. Removing the
onFocusReturnTargetFocus()call left all 108 DropdownMenu tests green, so the behavior could regress silently and the failure would be invisible: a keyboard user tabbing onto the trigger with no indication of where focus is.The change
One case in the existing
DropdownMenu focus return after a pointer picksuite: pick a row with the mouse, confirm the ring is suppressed, then return to the trigger by keyboard and confirm it is not.Verification
DropdownMenu.test.tsx— 109 pass.onFocusReturnTargetFocus()call sites fails exactly this case and nothing else.Scope
Test-only. No runtime, API, styling, or behavior change, so no changeset.