Skip to content

fix(DropdownMenu): a finger's hold-slide-lift no longer flashes the focus outline on the menu button - #10079

Merged
cixzhang merged 5 commits into
mainfrom
fix/dropdownmenu-touch-focus-ring
Nov 10, 2026
Merged

cixzhang merged 5 commits into
mainfrom
fix/dropdownmenu-touch-focus-ring

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

User impact

On a phone, opening a DropdownMenu with a press-and-hold, sliding onto a row and lifting flashes the focus outline on the menu button for a frame. The outline means "keyboard focus is here", but the person used a finger. After this change, a finger's hold-slide-lift shows no outline on the button at any frame. A tap, which opens through the browser's click, already showed none and still shows none. A keyboard open and close still show the outline.

Problem and solution fit

  1. Why does it occur? When a press opens the menu, DropdownMenu focuses the button first, so Escape or a pick can return focus to it (the APG menu-button pattern). That was a plain focus(). In Chromium a script focus after a touch press matches :focus-visible, so the button painted its ring for the frame before focus moved into the menu.
  2. Why does that harm the task? A ring after touch input says the keyboard owns focus. A one-frame flash on every hold-open is visible noise.
  3. Why does that matter? architecture:interaction-modality INV1: programmatic focus keeps the current modality, so after pointer input it shows no ring. The design owner's direction is that the outline appears only with keyboard modality.

Fix: that one focus move goes through the shared focusForLastInput (utils/focusReturn.ts), which the menu's row hover and list focus already use. It passes focusVisible: false after pointer or touch input and keeps the ring after keyboard input. Other focus moves in the menu are unchanged.

Expected behavior and authority

  • architecture:interaction-modality INV1 and INV2.
  • The design owner's direction: the outline appears only with keyboard modality, including during a hold-slide on the menu button.

Smallest restoration

  • DropdownMenu.tsx: the press-open focus call uses focusForLastInput.
  • DropdownMenuTouchFocusRing.a11y.chromium.spec.ts (new): real Chromium touch and keyboard, with the trigger sampled every frame.
  • A patch changeset.

Evidence

Real Chromium, touch emulation at 390×844, Storybook core-dropdownmenu--default. A per-frame recorder reads whether the button matches :focus-visible while focused.

Gesture main This pull request
Hold "Actions" until the menu opens, slide onto "Duplicate", lift 1 of 158 frames ringed (the frame the menu opened) 0 of 158
Tap "Actions", tap "Duplicate" (regression guard; a tap opens through the click) 0 of 107 0 of 107
Keyboard: Tab, Enter, Escape button ringed after Escape button ringed after Escape

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • DropdownMenuTouchFocusRing.a11y.chromium.spec.ts, red first. On main the hold-slide-lift case fails ("1 of 92 frames ringed the trigger"), and the tap and keyboard cases pass. Here all 3 pass.
  • vitest run packages/core/src/DropdownMenu: 13 files pass. Two a11y DOM-layer files timed out once under machine load and pass alone (17/17).
  • pnpm -F @astryxdesign/core typecheck, eslint, Prettier, pnpm check:changesets.

@vercel

vercel Bot commented Nov 5, 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 Nov 9, 2026 7:12pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 5, 2026
@astracat-bot

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 9, 2026, 7:19 PM UTC

@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 1bc297e

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 096b931

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
DropdownMenu 97.3 kB (+11 B) · 17.6 kB CSS (0) — ✓ · ✓ · ✓
MoreMenu 97.5 kB (+6 B) · 17.6 kB CSS (0) — — · — · —
ContextMenuItem 29.3 kB (0) · 6.3 kB CSS (0) — — · — · —
9 more components
Component Size LoC Visual · A11y · RTL
DropdownMenuCheckboxItem 22.8 kB (0) · 6.6 kB CSS (0) — ✓ · ✓ · ✓
DropdownMenuDivider 5.2 kB (0) · 548 B CSS (0) — ✓ · ✓ · —
DropdownMenuGroup 6.3 kB (0) · 3.4 kB CSS (0) — ✓ · ✓ · —
DropdownMenuItem 22.0 kB (0) · 6.3 kB CSS (0) — ✓ · ✓ · —
DropdownMenuRadioGroup 6.5 kB (0) · 3.3 kB CSS (0) — ✓ · ✓ · —
DropdownMenuRadioItem 22.8 kB (0) · 6.6 kB CSS (0) — ✓ · ✓ · —
DropdownMenuSubMenu 70.4 kB (0) · 9.7 kB CSS (0) — ✓ · ✓ · ✓
lab/Comments 351.4 kB (new) · 2.5 kB CSS (new) — — · — · —
lab/CommentThread 344.5 kB (new) · 2.4 kB CSS (new) — — · — · —

Package size: measured; main has no measurement of the merge base to compare yet.

API changes: cli +22 · ~7 · −0 (against the merge base's committed report); theme-butter +1 · ~0 · −0 (against the merge base's committed report); theme-y2k +1 · ~0 · −0 (against the merge base's committed report)

Committed API report behind this build: cli 29 rows, core 36 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.

31 API changes (advisory)
Package Where Signature Usage
+ cli ./api · Functions · function exportSearchIndex function exportSearchIndex @experimental: (options?: { cwd?: string | undefined; package?: string | undefined }) => Promise<SearchIndex> import {exportSearchIndex} from '@astryxdesign/cli/api'; exportSearchIndex(…)
+ cli ./api · Functions · function rankSearchIndex function rankSearchIndex @experimental: (query: string, indexes: SearchIndex | SearchIndex[], options?: { type?: SearchDomain | undefined; limit?: number | undefined }) => Promise<SearchResponse> import {rankSearchIndex} from '@astryxdesign/cli/api'; rankSearchIndex(…)
+ cli ./api · Types · type DocsListChild type DocsListChild = DocsNodeChild & { topic: string; description: string; children?: DocsListChild[]; childCount?: number } import type {DocsListChild} from '@astryxdesign/cli/api'
+ cli ./api · Types · type DocsListNamespace childCount?: number | undefined import type {DocsListNamespace} from '@astryxdesign/cli/api'; const x: DocsListNamespace = {childCount: …}
+ cli ./api · Types · type DocsListNamespace children?: DocsListChild[] | undefined import type {DocsListNamespace} from '@astryxdesign/cli/api'; const x: DocsListNamespace = {children: …}
+ cli ./api · Types · type SearchIndex type SearchIndex import type {SearchIndex} from '@astryxdesign/cli/api'
+ cli ./api · Types · type SearchResultEntry deprecated?: ComponentDeprecation | undefined import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …}
+ cli ./authoring · Types · interface ComponentDeprecation interface ComponentDeprecation import type {ComponentDeprecation} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface ComponentIconSlotDoc interface ComponentIconSlotDoc import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface ComponentIconSlotStateDoc interface ComponentIconSlotStateDoc import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface MultiComponentDoc deprecated?: ComponentDeprecation import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …}
+ cli ./authoring · Types · interface SingleComponentDoc deprecated?: ComponentDeprecation import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …}
+ cli ./doc · Types · interface ComponentBaseDoc deprecated?: ComponentDeprecation import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …}
+ cli ./doc · Types · interface SubComponentDoc deprecated?: ComponentDeprecation import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …}
+ cli ./doc · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/doc'
+ cli ./doc · Also exported from an earlier entry point · ComponentIconSlotDoc ComponentIconSlotDoc (./authoring) import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc'
+ cli ./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc ComponentIconSlotStateDoc (./authoring) import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc'
+ cli ./json · Also exported from an earlier entry point · DocsListChild DocsListChild (./api) import {DocsListChild} from '@astryxdesign/cli/json'
+ cli ./json · Also exported from an earlier entry point · SearchIndex SearchIndex (./api) import {SearchIndex} from '@astryxdesign/cli/json'
+ cli ./template · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/template'
+ cli ./template · Also exported from an earlier entry point · ComponentIconSlotDoc ComponentIconSlotDoc (./authoring) import {ComponentIconSlotDoc} from '@astryxdesign/cli/template'
+ cli ./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc ComponentIconSlotStateDoc (./authoring) import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template'
~ cli ./api · Functions · function search function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> import {search} from '@astryxdesign/cli/api'; search(…)
~ cli ./api · Types · type SwizzleCopyResponse data: { component: string; package: string; outputDir: string; filesCopied: number; files: string[]; usesStyleX: boolean; feedback?: SwizzleFeedback | undefined } → data: { component: string; package: string; outputDir: string; filesCopied: number; files: string[]; usesStyleX: boolean; dependencies: Record<string, string>; marker … #84d9505b import type {SwizzleCopyResponse} from '@astryxdesign/cli/api'; const x: SwizzleCopyResponse = {data: …}
~ cli ./authoring · Types · interface MultiComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …}
~ cli ./authoring · Types · interface SingleComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …}
~ cli ./authoring · Types · type TemplateCategory type TemplateCategory = | 'Dashboard - Analytics' | 'Dashboard - Comparison' | 'Dashboard - KPI Summary' | 'Dashboard - Monitoring' | 'Dashboard - Executive Summary' | 'Dashboard - Sco … #e7c18378 → type TemplateCategory = | 'Dashboard - Analytics' | 'Dashboard - Comparison' | 'Dashboard - KPI Summary' | 'Dashboard - Monitoring' | 'Dashboard - Executive Summary' | 'Dashboard - Sco … #a8be998f import type {TemplateCategory} from '@astryxdesign/cli/authoring'
~ cli ./doc · Types · interface ComponentBaseDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …}
~ cli ./doc · Types · interface SubComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …}
+ theme-butter Public attributes · attr data-astryx-pressable attr data-astryx-pressable (public data attribute) [data-astryx-pressable] { … }
+ theme-y2k Public attributes · attr data-astryx-pressable attr data-astryx-pressable (public data attribute) [data-astryx-pressable] { … }

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | 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.

Changes requested: the code fix is sound, but the title and changeset claim more than the change does.

  • The title and .changeset/dropdown-menu-touch-focus-ring.md say a finger's tap no longer flashes the focus outline and that sub-menu focus returns changed, but a tap opens the menu through the browser's click and never reaches the changed focus call (the PR's own measurement shows 0 ringed frames for a tap on main) and nothing shows a sub-menu ring on main, so please describe only the hold-slide-lift case, for example "a finger's hold-slide-lift no longer flashes the focus outline on the menu button".

Keep the tap test as a regression guard, and either drop the sub-menu sentence or add a case that fails on main for it. The same change also removes a one-frame ring on a mouse press-open, which follows the interaction-modality rule; mentioning it is optional.

[Automated review]

@cixzhang cixzhang changed the title fix(DropdownMenu): a finger's hold-slide-lift or tap no longer flashes the focus outline on the menu button fix(DropdownMenu): a finger's hold-slide-lift no longer flashes the focus outline on the menu button Nov 5, 2026
@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 9517e72

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

Approved pending CI: CI is still running on this head and has not finished yet.

The press-open focus now goes through the shared focusForLastInput, which matches the interaction-modality rule that programmatic focus after pointer input shows no outline. The new Chromium spec fails on main for the hold-slide-lift case and passes here, and the tap and keyboard guards still pass. The title and changeset now describe only the case the change fixes, which resolves the earlier request.

[Automated review]

@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 13:15
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 9517e72

# Conflicts:
#	packages/core/src/DropdownMenu/DropdownMenu.tsx
@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 9, 2026

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

Changes requested: the focus fix itself is right, but the new Chromium spec fails on this head.

  • Regression: the tap case in DropdownMenuTouchFocusRing.a11y.chromium.spec.ts (lines 159-166) taps "Duplicate" while the menu is still entering, which DropdownMenu's entrance hold ignores since the merge of main, so expect(menu).toBeHidden() times out on every run; wait for the menu's entrance to rest before the row tap, as DropdownMenuEntranceHold.interaction.browser.spec.ts does with waitForRest.

The hold-slide-lift case fails on main and passes here, and the keyboard case passes on both. With that wait added, the tap case passes with no ringed frame.

[Automated review]

…ntrance rests

Since main's entrance hold, the menu ignores a tap while it is still
entering, so the tap case waited forever for the menu to close. The proof
now waits for the entrance to rest before the row tap, as the entrance
hold's own proof does.

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

Approved pending CI: heavy CI (build and tests) has not run on this head yet; it runs when the pull request is marked ready or queued to merge.

The press-open focus now goes through the shared focusForLastInput, so a finger's hold-slide-lift no longer rings the menu button, and the new Chromium spec fails on main and passes here. The tap case now waits for the menu's entrance to rest before tapping a row, which fixes the timeout from the previous review, and the keyboard ring after Escape is unchanged.

[Automated review]

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 096b931

@cixzhang
cixzhang marked this pull request as draft November 10, 2026 01:29
@cixzhang
cixzhang marked this pull request as ready for review November 10, 2026 01:29
@cixzhang
cixzhang merged commit 2309691 into main Nov 10, 2026
129 of 133 checks passed
@github-actions
github-actions Bot deleted the fix/dropdownmenu-touch-focus-ring branch November 10, 2026 06:04

This branch was successfully deployed

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

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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