Skip to content

test(DropdownMenu): pin the focus ring returning with the keyboard - #6901

Merged
cixzhang merged 1 commit into
mainfrom
menu-focus-ring-regression
Oct 3, 2026
Merged

cixzhang merged 1 commit into
mainfrom
menu-focus-ring-regression

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

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 onFocus clears 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 pick suite: 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.
  • Proven to be a real guard, not a passing-by-accident test: removing both onFocusReturnTargetFocus() call sites fails exactly this case and nothing else.

Scope

Test-only. No runtime, API, styling, or behavior change, so no changeset.

#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.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 3, 2026
@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 3, 2026 12:51am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 3, 2026, 1:01 AM UTC

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot 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.

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]

@cixzhang
cixzhang merged commit 8488420 into main Oct 3, 2026
44 checks passed
@cixzhang
cixzhang deleted the menu-focus-ring-regression branch October 3, 2026 01:24

This branch was successfully deployed

1 active deployment
Preview — a9f8f4cd Deployed Oct 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant