Skip to content

fix(DropdownMenu): a checkbox or switch in a sheet row's end content keeps its own press - #13692

Merged
cixzhang merged 10 commits into
meta:mainfrom
bstcoc:fix/sheet-row-end-content-controls
Nov 25, 2026
Merged

cixzhang merged 10 commits into
meta:mainfrom
bstcoc:fix/sheet-row-end-content-controls

Conversation

@bstcoc

@bstcoc bstcoc commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #13636

User impact

In a DropdownMenu or ContextMenu shown as a bottom sheet, a checkbox in an action row's endContent never toggles when it is tapped or clicked, and a switch never toggles when it is clicked. The row does not run either, so the person gets no response. A tapped switch toggles only about 300 ms after the finger lifts, through its own no-click fallback.

Problem and solution fit

  • Why does it fail? The sheet's press model tracks every press inside the sheet. A press on a checkbox input matches no row (SHEET_ROW_SELECTOR is button:not(:disabled), a[href]), so the release acts on nothing, and the model then swallows the browser's click as the stray click of a tracked gesture. That click is the one that would toggle the input.
  • Why does it harm the task? The control looks interactive, but nothing toggles it by mouse, and a finger gets a late toggle.
  • Why does that matter? Callers put controls in endContent even though DropdownMenuItem's docs call it non-interactive; the sheet should not leave a visible control dead.

The fix follows FR5's existing rule that a control in the row's content keeps its own press: the sheet's press model no longer tracks a press that starts on a control in a row's content (a switch, a checkbox, a button or a link that is not the row's own action). useMenuPressInternal (not exported from any package entry) takes an internal ownsPress(target) argument, checked at pointerdown, that the public useMenuPress never forwards; the sheet calls useMenuPressInternal with isRowContentControl. UseMenuPressOptions is unchanged. Such a press is not tracked, acts on nothing and swallows no click, so the control handles its own press: a checkbox toggles on the browser's click, and a switch decides its own tap and drag, exactly as outside a menu.

This needs no change to Switch, no private attribute, and no new FR15 sentence. Earlier revisions of this PR made the sheet click the control and then patched Switch for the double toggles that caused; both are gone.

Expected behavior and authority

component:DropdownMenu FR5 already says that "a control in the row's content keeps its own press" in the Touch sheet. FR5 now spells out the outcome: a button or a link runs its own action, and a checkbox or a switch toggles. The FR5 (sheet rows) evidence row names the new cases. module:DropdownMenu/useMenuPress FR5 already says a click with no tracked gesture behind it acts on its target.

Smallest restoration

  • useMenuPress.ts: an internal ownsPress argument of useMenuPressInternal (one check in the menu's pointerdown); the public options are unchanged.
  • MenuBottomSheetActionList.tsx: isRowContentControl, passed as ownsPress to useMenuPressInternal.
  • A Storybook story (Presentation / action sheet, end-content controls) for the browser evidence.

No API, visual or default change.

Evidence

  • Reproduction before the change: the new unit cases fail (Received element is not checked) for a touch and a mouse press on a <Switch> and on a plain checkbox.
  • Result after the change: they pass. The control is checked and no row runs.
  • Mutation-sensitive proof: removing ownsPress from the sheet fails the four unit cases "a %s press on a %s in a row's end content toggles it and runs no row".
  • Real browser (DropdownMenuSheetRowPress.interaction.browser.spec.ts, Chromium and WebKit): a real-touch tap and a mouse click on a Switch, a CheckboxInput and a native checkbox each toggle it once and run no row; a finger and a mouse that drag a sheet-row switch past its flip and back fire no change and leave it unchecked.
  • Disabled controls: the sheet's press model neither focuses nor presses a disabled Switch or CheckboxInput (aria-disabled) in end content (unit test, jsdom; this covers the sheet's handling only, not the controls themselves).
  • Unchanged paths: a press on a row's icon, padding or non-control end content still runs the row; section headings, disabled rows and submenu chevrons behave as before.
  • Follow-up, not in this pull request: the new story's description could say it is a press fixture, not a recommended layout (DropdownMenu story: say the end-content controls story is a press fixture, not a recommended layout (from #13692) #13744).

Scope

Components: DropdownMenu, ContextMenu

  • 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

  • pnpm exec vitest run --project ui packages/core/src/DropdownMenu packages/core/src/ContextMenu packages/core/src/hooks packages/core/src/Switch: 1875 pass.
  • pnpm storybook:build && pnpm test:interaction DropdownMenuSheetRowPress: 28 pass (Chromium, WebKit).
  • pnpm test:interaction DropdownMenu ContextMenu: 106 pass.
  • pnpm -F @astryxdesign/core typecheck, lint and pnpm check:knowledge pass.
  • The branch merges cleanly with current main; it will take another merge once the in-flight sheet press change lands.

Writing rubric results

FR5 edit: present tense, active voice, one fact per sentence, and it describes the system with no history or project status.

First-load size (architecture:component-import-boundaries INV10)

useMenuPress is a shared module, so here is pnpm size:pages --base <main 2a419f39> --unused-on docs,form,menu,table at 8726e03 (esbuild, minified / gzip bytes, measured by an Astryx maintainer):

Page (components) Base Head Change
docs (Text, Heading, Link, Card, Divider, List) 242,042 / 80,101 242,042 / 80,101 +0 / +0
form (Button, IconButton, TextInput, CheckboxInput, Text, Heading, Card) 327,858 / 110,818 327,858 / 110,818 +0 / +0
menu (DropdownMenu, ContextMenu, Button, Text) 398,642 / 136,470 398,743 / 136,525 +101 / +55
table (Table, Text, Button) 379,859 / 129,237 379,974 / 129,293 +115 / +56

The module graph is unchanged on every page. All four pages PASS INV10's 0.3 KB gzip limit for apps that do not use the new option.

…toggles on press

In a bottom-sheet DropdownMenu or ContextMenu, a press on a checkbox or
switch in a row's endContent resolved to no row, and the menu's click guard
then swallowed the browser's click, so the control never toggled. The sheet
now treats an enabled checkbox input as its own press target, as it already
does for a button or a link, and the DropdownMenu spec records it.

Fixes meta#13636
@vercel

vercel Bot commented Nov 23, 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 25, 2026 2:27am UTC

Request Review

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

astracat-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 25, 2026, 2:59 AM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:spec-owner-review Current knowledge records await owner approval labels Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 8726e03

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
BreadcrumbItem 106.1 kB (+74 B) · 14.2 kB CSS (0) — — · — · —
DropdownMenuSubMenu 82.9 kB (+74 B) · 11.5 kB CSS (0) — ✓ · ✓ · ✓
lab/VideoPlayer 240.0 kB (+69 B) · 2.1 kB CSS (0) — — · — · —
34 more components
Component Size LoC Visual · A11y · RTL
richtext/RichTextEditorToolbar 319.9 kB (+69 B) · 454 B CSS (0) — — · — · —
lab/MediaCaptionsButton 232.7 kB (+68 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTime 232.7 kB (+68 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTimeSlider 232.7 kB (+67 B) · 1.5 kB CSS (0) — — · — · —
Table 129.4 kB (+66 B) · 21.4 kB CSS (0) — — · — · —
lab/MediaPlayButton 232.7 kB (+66 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaSeekButton 232.7 kB (+66 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaVolume 232.7 kB (+66 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaFullscreenButton 232.7 kB (+65 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlaybackRate 232.6 kB (+65 B) · 1.5 kB CSS (0) — — · — · —
ContextMenu 110.0 kB (+63 B) · 19.8 kB CSS (0) — — · — · —
NavHeadingMenu 19.5 kB (+61 B) · 3.5 kB CSS (0) — — · — · —
TopNavMenu 90.4 kB (+61 B) · 12.6 kB CSS (0) — — · — · —
TableCell 111.1 kB (+58 B) · 20.5 kB CSS (0) — — · — · —
TabMenu 87.4 kB (+55 B) · 12.5 kB CSS (0) — — · — · —
lab/Comments 394.3 kB (+55 B) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 387.4 kB (+55 B) · 2.4 kB CSS (0) — — · — · —
Markdown 214.1 kB (+51 B) · 23.7 kB CSS (0) — — · — · —
Selector 124.7 kB (+51 B) · 19.9 kB CSS (0) — — · — · —
SideNavHeading 91.2 kB (+51 B) · 12.7 kB CSS (0) — — · — · —
lab/AudioPlayer 242.5 kB (+51 B) · 1.8 kB CSS (0) — — · — · —
DropdownMenu 136.5 kB (+50 B) · 20.0 kB CSS (0) — ✓ · ✓ · ✓
TableHeaderCell 111.0 kB (+49 B) · 20.2 kB CSS (0) — — · — · —
PowerSearch 323.8 kB (+44 B) · 27.5 kB CSS (0) — — · — · —
TopNavHeading 90.9 kB (+41 B) · 12.6 kB CSS (0) — — · — · —
MoreMenu 136.7 kB (+39 B) · 20.0 kB CSS (0) — — · — · —
Pagination 157.5 kB (+24 B) · 20.3 kB CSS (0) — — · — · —
ContextMenuItem 40.1 kB (0) · 7.4 kB CSS (0) — — · — · —
DropdownMenuCheckboxItem 30.3 kB (0) · 7.7 kB CSS (0) — ✓ · ✓ · ✓
DropdownMenuDivider 5.4 kB (0) · 548 B CSS (0) — ✓ · ✓ · —
DropdownMenuGroup 6.6 kB (0) · 3.4 kB CSS (0) — ✓ · ✓ · —
DropdownMenuItem 29.5 kB (0) · 7.2 kB CSS (0) — ✓ · ✓ · —
DropdownMenuRadioGroup 6.7 kB (0) · 3.4 kB CSS (0) — ✓ · ✓ · —
DropdownMenuRadioItem 30.4 kB (0) · 7.7 kB CSS (0) — ✓ · ✓ · —

Package size: @astryxdesign/core 8.04 MB packed (+701 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.


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.

This pull request needs an engineering owner's decision on its spec wording before it can be approved, and one finding needs work after that.

It rewords the DropdownMenu record's FR5 to say that a checkbox or a switch in a sheet row's end content toggles, and adds those cases to the FR5 (sheet rows) verification row. An engineering owner records approval by commenting /approve-spec <full head SHA> (the author may do so if they are an engineering owner), or says what to change.

  • The changeset says a switch now toggles when tapped, but the tests fire jsdom pointer events that never reach Switch's own touchend lift, and the code suggests a real finger tap turns the switch on and then back off about 300 ms later (useSwitchTouch.ts:762-771), so please add real-touch tap cases for Switch, CheckboxInput and a plain checkbox to DropdownMenuSheetRowPress.interaction.browser.spec.ts, fix any double activation they show, and word the changeset to what they prove.

A smaller point: :not(:disabled) still matches a disabled Switch or CheckboxInput, because they disable with aria-disabled, so the sheet focuses and clicks them; excluding [aria-disabled="true"] too would avoid that.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: the sheet's old press targets were enabled buttons and links only. Verified in the base source.
  • Claim: a press on a checkbox was kept as the control's own press, matched no row, and its click was then swallowed. Verified in the sheet's hit test and the press model.
  • Claim: end-content switches are the documented way to show a per-row setting. Not found in the menu, list or CLI docs.
  • Claim: the pointer menu toggles them. Not verified.
  • Claim: the fix adds enabled checkbox inputs to the press targets. Partly inaccurate: aria-disabled switches and checkboxes match too.
  • Claim: a press now runs the same path as a button or a link, and the duplicate click is swallowed. Verified by reading the press model.
  • Claim: FR5 already says a control in the row keeps its own press, and the issue asks to record the outcome. Verified.
  • Claim: FR5 and its verification row now name checkboxes and switches. Verified.
  • Claim: one selector and its comment change; no API, visual or default change. Verified.
  • Claim: the new cases fail before the change and pass after it, and the suites, typecheck, lint and knowledge checks pass. Not verified: they could not be run for this review, and CI has not run.
  • Changeset claim: a checkbox or switch in a sheet row now toggles when tapped or clicked, and did not before. Unproven for a switch under a finger (finding above).
  • File .changeset/sheet-row-end-content-toggle.md: finding (switch claim).
  • File docs/specs/components/DropdownMenu/DropdownMenu.spec.md: FR5 and its verification row await owner approval; the other changed lines only re-pad a table column.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.test.tsx: covers the press model in jsdom; no real-touch case for Switch.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.tsx: selector change; switch double-activation risk and the aria-disabled note above.

Automated review (maintainer link)

In a bottom-sheet menu, the sheet toggles an end-content switch on the
finger's release. The switch's own lift then committed from the new value
and clicked the input again 300 ms later, so a tap turned the switch on and
back off. The lift now commits from the value the finger landed on.

Also: disabled Switch and CheckboxInput (aria-disabled) are no sheet press
target, and real-touch and mouse cases for Switch, CheckboxInput and a
native checkbox prove the sheet behavior in Chromium and WebKit.
@bstcoc bstcoc changed the title fix(DropdownMenu): a checkbox or switch in a sheet row's end content toggles on press fix(DropdownMenu, Switch): a checkbox or switch in a sheet row's end content toggles once on press Nov 23, 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.

This pull request needs an engineering owner's decision on its record wording before it can be approved, and two claims need correcting after that.

It rewords the DropdownMenu record's FR5 and its sheet-rows verification row to say that a checkbox or switch in a sheet row's end content toggles, and adds a sentence to the Switch record's FR15 that a click during the press is the press's one toggle; an engineering owner records approval by commenting /approve-spec <full head SHA> (the author may do so if they are an engineering owner), or says what to change.

  • The changeset says a tapped switch in a sheet row did not change before, but on main the switch's own no-click fallback toggles it about 300 ms after the finger lifts (the same fallback behind the double toggle the description explains), so please reword it to say that a checkbox now toggles when tapped or clicked, a switch when clicked, and a tapped switch now toggles at the release instead of about 300 ms later.
  • Miss: the description says end-content switches are the documented way to show a per-row setting, but DropdownMenuItem's docs call endContent non-interactive and list controls there as a practice to avoid, so please drop or correct that sentence.

The earlier double-toggle and disabled-control points are fixed, and two smaller notes remain: the new FR15 sentence reads broader than the code, which only skips the switch's own fallback click, and no case covers a disabled Switch or CheckboxInput in end content.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Claim: the sheet's old press targets were enabled buttons and links, and a press on a checkbox matched no row and lost its click. Verified in the base sheet and press model.
  • Claim: end-content switches are the documented way to show a per-row setting. False: the item docs call end content non-interactive.
  • Claim: the pointer menu toggles end-content switches. Not verified.
  • Claim: the fix adds enabled checkbox and switch inputs, excluding aria-disabled ones, and a press on one runs its own click while the duplicate is swallowed. Verified.
  • Claim: with only that change, a finger tap on a switch toggled twice, because its lift computed from the toggled value and clicked again about 300 ms later. Verified by reading the switch's lift.
  • Claim: the lift now commits from the value at touch-down. Verified.
  • Claim: a story shows the three controls, with no API, visual or default change. Verified.
  • Claim: FR5 already says a control keeps its own press, and the FR5 and FR15 edits need an owner's approval. Verified.
  • Claim: the new unit cases fail before the change. True in the unit test environment; for a tapped switch that failure comes from the environment sending no touch end, not from the shipped behavior.
  • Claim: the browser cases tap and click each control in Chromium and WebKit, and the switch tap case fails without the Switch change. Not run for this review; CI has not run.
  • Claim: the listed test, typecheck, lint and knowledge runs pass. Not run for this review.
  • Changeset claim: a checkbox or switch now toggles when tapped or clicked, and did not change before. False for a tapped switch (finding above).
  • Changeset claim: a click during a finger's press is the press's one toggle, and the lift no longer toggles it back. Verified where the browser sends no click for the lift, as in the sheet.
  • File .changeset/sheet-row-end-content-toggle.md: finding (tapped-switch claim).
  • File apps/storybook/stories/DropdownMenu.stories.tsx: clear.
  • File docs/specs/components/DropdownMenu/DropdownMenu.spec.md: FR5 and its verification row await owner approval; the other lines only re-pad a table.
  • File docs/specs/components/Switch/Switch.spec.md: the FR15 sentence awaits owner approval and reads broader than the code; the other lines only re-pad a table.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.test.tsx: clear; no disabled-control case.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.tsx: clear.
  • File packages/core/src/DropdownMenu/__tests__/DropdownMenuSheetRowPress.interaction.browser.spec.ts: clear; the switch tap case would also pass on main.
  • File packages/core/src/Switch/useSwitchTouch.ts: clear; a comment wording suggestion.

Automated review (maintainer link)

…'s end content takes no press

Narrows Switch FR15 to the switch's own click and rewords the changeset
to what changed for a tapped switch.

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

This pull request needs an engineering owner's decision on its record wording before it can be approved; no other blocking finding remains, and both earlier points (the changeset's tapped-switch claim and the description's endContent claim) are fixed.

It rewords the DropdownMenu record's FR5 and its sheet-rows verification row to say that a checkbox or a switch in a sheet row's end content toggles, and adds a sentence to the Switch record's FR15 that a click during the press is the press's one toggle. An engineering owner records approval by commenting /approve-spec <full head SHA> (the author may do so if they are an engineering owner), or says what to change. CI has not run yet: a maintainer adds the ci:run label so it runs.

  • Optional: the switch now skips its own click after any value change during the press, an app's included, while the new FR15 sentence names only a click; either word FR15 for a value change during the press or narrow the code.
Claims and files checked

Review mode: full; reason: author-not-engowner

  • Description: on main, a checkbox in a sheet row's end content never toggles on a tap or click, and a switch never toggles on a click; no row runs. Verified: the input matches no row, and the stray-press guard swallows the click (useMenuPress.ts:546, :738-745).
  • Description: on main, a tapped switch toggles only about 300 ms after the lift, through its own fallback. Verified on the base (useSwitchTouch.ts:769, browserClickWait.ts:25).
  • Description: callers put controls in end content although the item docs call it non-interactive. Docs part verified (DropdownMenuItem.doc.mjs:113); caller usage taken from the linked issue.
  • Description: the fix adds enabled checkbox and switch inputs, excluding aria-disabled ones, and a press on one dispatches its own click while the guard swallows the browser's duplicate. Verified (MenuBottomSheetActionList.tsx:34-35, useMenuPress.ts:635-715).
  • Description: with only that change, a finger tap toggled a switch twice, because its lift computed from the toggled value and clicked again about 300 ms later. Verified by reading the switch's lift.
  • Description: the lift now commits from the value at touch-down. Verified (useSwitchTouch.ts:600, :745).
  • Description: the DropdownMenu record already says a control in the row's content keeps its own press, and both record edits need an owner's approval. Verified.
  • Description: one selector, one field and a story, with no API, visual or default change. Verified from the source.
  • Description: the new unit cases fail before the change and pass after it, and the disabled case fails if the aria-disabled exclusion is dropped. Consistent with the code; not run for this review.
  • Description: the browser cases tap and click each control in Chromium and WebKit, and the switch tap case fails without the Switch change. Consistent with the code; not run, and CI has not run.
  • Description: the listed test, typecheck, lint, knowledge and Storybook runs pass. Not run for this review.
  • Changeset: a checkbox now toggles when tapped or clicked and a switch when clicked; a tapped switch toggles at the release instead of about 300 ms later. Verified from base and head code.
  • Changeset: a click during a finger's press is the press's one toggle, and the switch no longer clicks its input again after the lift. Verified for a lift with no browser click, which is the sheet's case (useSwitchTouch.ts:776).
  • File .changeset/sheet-row-end-content-toggle.md: clear.
  • File apps/storybook/stories/DropdownMenu.stories.tsx: clear.
  • File docs/specs/components/DropdownMenu/DropdownMenu.spec.md: FR5 and its verification row await owner approval; the other lines only re-pad a table.
  • File docs/specs/components/Switch/Switch.spec.md: the FR15 sentence awaits owner approval and names only a click; the verification row does not name the new evidence; the other lines only re-pad a table.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.test.tsx: clear.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.tsx: clear.
  • File packages/core/src/DropdownMenu/__tests__/DropdownMenuSheetRowPress.interaction.browser.spec.ts: clear; the switch tap case does not pin the release timing.
  • File packages/core/src/Switch/useSwitchTouch.ts: clear; a comment wording suggestion.

Automated review (maintainer link)

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

This pull request needs an engineering owner's decision on its record wording before it can be approved, and one finding needs a fix.

It rewords the DropdownMenu record's FR5 and its sheet-rows verification row to say that a checkbox or a switch in a sheet row's end content toggles, and adds a sentence to the Switch record's FR15 that a change of value during the press is that press's toggle. An engineering owner records approval by commenting /approve-spec <full head SHA> (the author may do so if they are an engineering owner), or says what to change.

  • Miss: in a sheet row, a Switch drag that flips the thumb and comes back past where it pressed now toggles it on and then off, two onChange calls for one gesture, because the sheet clicks the switch at the release and the switch's own flipped-drag lift clicks it back (MenuBottomSheetActionList.tsx:35, useSwitchTouch.ts:784-788), so please leave a press the switch took as a drag to the switch, add a browser case that drags a sheet-row switch past the flip and back, and keep the changeset's Switch line to what then holds.

The earlier FR15 wording point is fixed, and CI is still waiting for a maintainer's ci:run label.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Description: on main, in a sheet, a checkbox in a row's end content never toggles on a tap or a click and a switch never toggles on a click, and no row runs. Verified: the input matched no row and the stray-press guard swallowed the click.
  • Description: on main, a tapped switch toggles only about 300 ms after the lift, through its own fallback. Verified in the base switch code.
  • Description: callers put controls in end content although the item docs call it non-interactive. Docs part verified; caller usage taken from the linked issue.
  • Description: the fix adds enabled checkbox and switch inputs, excluding aria-disabled ones, and a press on one dispatches its own click while the guard swallows the browser's duplicate. Verified for a tap and a click; for a switch drag that flips and comes back the press toggles twice (finding above).
  • Description: with only the selector change a finger tap toggled a switch twice, and the lift now commits from the value at touch-down. Verified by reading the switch's lift.
  • Description: the DropdownMenu record already says a control keeps its own press, the record edits state the outcome, and both need an owner's approval. Verified.
  • Description: one selector, one field and a story, with no API, visual or default change. Verified from the source.
  • Description: the new unit cases fail before the change and pass after it, and the disabled case fails without the aria-disabled exclusion. Consistent with the code; not run for this review.
  • Description: the browser cases tap and click each control in Chromium and WebKit, and the switch tap case fails without the Switch change. Consistent with the code; not run, and CI has not run.
  • Description: the listed test, typecheck, lint, knowledge and Storybook runs pass. Not run for this review.
  • Changeset: a checkbox now toggles when tapped or clicked and a switch when clicked, and a tapped switch toggles at the release instead of about 300 ms later. Verified from the base and head code; no case pins the timing.
  • Changeset: a click during a finger's press is the press's one toggle, and the switch no longer clicks its input again after the lift. True for a tap or a hold; false for a flipping drag that comes back (finding above).
  • File .changeset/sheet-row-end-content-toggle.md: its Switch line is untrue for a flipping drag that comes back (finding above).
  • File apps/storybook/stories/DropdownMenu.stories.tsx: clear.
  • File docs/specs/components/DropdownMenu/DropdownMenu.spec.md: FR5 and its verification row await owner approval; the other lines only re-pad a table.
  • File docs/specs/components/Switch/Switch.spec.md: the FR15 sentence awaits owner approval and now matches the code; its verification row does not name the new case; the other lines only re-pad a table.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.test.tsx: clear; no drag case.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.tsx: finding (switch drag).
  • File packages/core/src/DropdownMenu/__tests__/DropdownMenuSheetRowPress.interaction.browser.spec.ts: no drag case; the switch tap case does not pin the release timing.
  • File packages/core/src/Switch/useSwitchTouch.ts: part of the finding; a comment wording suggestion.

Automated review (maintainer link)

A drag that flips a Switch's thumb and comes back past where it pressed
toggled the switch twice in a sheet row: the sheet clicked it at the
release, then the switch's own lift clicked it back. Switch now marks its
input once a drag flips it, and the sheet's press targets skip that input.

@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 are requested: the sheet fix itself follows component:DropdownMenu FR5, but its new press check ships as public API.

  • ownsPress in packages/core/src/hooks/useMenuPress.ts is a new option on the public useMenuPress hook from @astryxdesign/core/hooks, outside this pull request's DropdownMenu and ContextMenu scope, so move it behind a non-exported boundary (for example an internal parameter of useMenuPressInternal, which the sheet then calls), or name the hook in the scope and get an owner decision for the option.
  • The description says the option is internal and that there is no API change, but UseMenuPressOptions is exported from @astryxdesign/core/hooks, so the option is public; the boundary move above makes both statements true.

An engineering owner has already noted that the FR5 rewording spells out the record's existing rule. CI has not run on this head yet; a maintainer adds the ci:run label so it runs.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Claim (changeset): in a sheet, an end-content checkbox now toggles on a tap or a click, and a switch on a click: verified (the press is no longer tracked, so the browser's click reaches the input; unit cases).
  • Claim (changeset): a tapped switch now toggles at the release instead of about 300 ms later: verified (on the base the switch's own fallback waits 300 ms for a click the sheet swallowed).
  • Claim (changeset): the sheet leaves a press that starts on a control in a row's content to that control: verified in the press hook and the sheet's predicate.
  • Claim: on the base nothing toggles and no row runs, because a checkbox matches no row and the stray-click guard eats the browser's click: verified on the base.
  • Claim: callers put controls in end content although the item docs call it non-interactive: verified in the item docs.
  • Claim: the fix follows the menu record's existing rule that a content control keeps its own press: verified in the current record.
  • Claim: the press hook gains an internal option: false; the option is on the hook's exported options type, so it is public.
  • Claim: such a press is not tracked, acts on nothing and swallows no click: verified (early return before the pointer is claimed; the guard disarms at the next press).
  • Claim: no change to the switch, no private attribute and no new switch record sentence: verified; no switch file changes.
  • Claim: the record now spells out the outcome and its evidence row names the new cases: verified.
  • Claim: the press hook's record already says a click with no tracked gesture acts on its target: verified.
  • Claim: the smallest-restoration list (hook option, sheet predicate, story): verified.
  • Claim: no API, visual or default change: false for API (new public hook option); no visual or default change, verified.
  • Claim: the new unit cases fail before the change and pass after it, and removing the option from the sheet fails them: consistent with the code path; not run here.
  • Claim: real-browser tap, click and drag cases pass in Chromium and WebKit: the cases exist and read correctly; not run here.
  • Claim: disabled switches and checkboxes in end content are neither focused nor pressed: covered by unit cases; consistent.
  • Claim: a press on a row's icon, padding or non-control end content still runs the row, and headings, disabled rows and sub-menu chevrons are unchanged: verified (none of those is a content control).
  • Claim: the listed test, build, typecheck, lint and knowledge commands pass: not verified; not run here and CI has not run.
  • Claim: the branch merges cleanly with the main branch: verified.
  • Claim: the record edit follows the writing rubric: consistent.
  • Claim: the scope is DropdownMenu and ContextMenu: verified that both use the sheet's action list; the hook option falls outside it.
  • File .changeset/sheet-row-end-content-toggle.md: clear.
  • File apps/storybook/stories/DropdownMenu.stories.tsx: clear (non-blocking: shows controls the item docs discourage).
  • File docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear; the wording spells out the existing rule.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.test.tsx: clear.
  • File packages/core/src/DropdownMenu/MenuBottomSheetActionList.tsx: clear (non-blocking comment-style suggestion).
  • File packages/core/src/DropdownMenu/__tests__/DropdownMenuSheetRowPress.interaction.browser.spec.ts: clear.
  • File packages/core/src/hooks/useMenuPress.ts: blocking findings above.

Automated review (maintainer link)

Comment thread packages/core/src/hooks/useMenuPress.ts Resolved

@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: the required checks have not passed on this head yet.

The sheet now leaves a press that starts on a control in a row's content to that control, which restores DropdownMenu FR5. The earlier blocking point is fixed: the press check is internal to the menu press hook, so no public API changes.

Next steps:

  • If the required checks still wait for a maintainer, a maintainer adds the ci:run label so CI runs.
  • The FR5 edit to the DropdownMenu record still needs the repository's spec-owner approval: an engineering owner comments /approve-spec <full head SHA>.

Two optional points:

  • The new story puts controls in endContent, which DropdownMenuItem's docs advise against; its description could say it is a press fixture, not a recommended layout.
  • The description says a disabled Switch or CheckboxInput in end content "is neither focused nor pressed", but its unit test runs in jsdom and shows only that the sheet neither focuses nor presses it.
Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • Changeset: a checkbox in a sheet row's end content now toggles on a tap or a click, and a switch on a click: verified (the press check in the menu press hook, the sheet's predicate, and the new unit and browser cases).
  • Changeset: a tapped switch now toggles at the release instead of about 300 ms later: verified (on the base the swallowed click leaves the switch to its 300 ms no-click fallback; on the head the browser's click reaches it).
  • Changeset: the sheet leaves a press that starts on a control in a row's content to that control: verified (the sheet's row-content predicate).
  • Description, user impact and cause (no row matches the control, the release acts on nothing, the click is swallowed): verified against the sheet's row selector and the press model's click guard.
  • Description: the press check is an internal argument the public hook never forwards, and the public options are unchanged: verified (the hooks entry exports only the public hook; the options type matches the base).
  • Description: no change to Switch, no private attribute, no new Switch sentence: verified (changed files).
  • Description: FR5 already says a control in the row's content keeps its own press, and the press hook's record already lets an untracked click act: verified against the current records.
  • Description: no API, visual or default change: verified.
  • Description: the new unit cases fail before the change and fail again without the predicate: verified by the code path (not run here).
  • Description: real-browser cases for tap, click and drag in Chromium and WebKit: present in the browser spec (not run here).
  • Description: a disabled Switch or CheckboxInput in end content is neither focused nor pressed: verified for the sheet only (see the optional point above).
  • Description: presses on a row's icon, padding or non-control end content, headings, disabled rows and submenu chevrons behave as before: verified (the predicate answers no for them; existing cases unchanged).
  • Description: the test, typecheck, lint and knowledge-check results: not checkable here, since CI has not run.
  • Description: the branch merges cleanly with main: verified.

Files:

  • .changeset/sheet-row-end-content-toggle.md: clear.
  • apps/storybook/stories/DropdownMenu.stories.tsx: optional point (story shows a discouraged pattern).
  • docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear (FR5 wording ruled a restatement by an engineering owner; the rest of the table is re-padding).
  • packages/core/src/DropdownMenu/MenuBottomSheetActionList.test.tsx: clear.
  • packages/core/src/DropdownMenu/MenuBottomSheetActionList.tsx: clear.
  • packages/core/src/DropdownMenu/__tests__/DropdownMenuSheetRowPress.interaction.browser.spec.ts: clear.
  • packages/core/src/hooks/useMenuPress.ts: clear.

Automated review (maintainer link)

story: {inline: false, height: '560px'},
description: {
story:
'A switch, a checkbox and a native checkbox in the end content of bottom-sheet rows. A press on a control toggles it and runs no row.',

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.

Optional: DropdownMenuItem.doc.mjs calls endContent non-interactive and lists controls there as a practice to avoid (:14, :29, :113). Since this story renders in the docs, a sentence saying it is a press fixture, not a recommended layout, would keep readers from copying it. For example: "A press fixture: a switch, a checkbox and a native checkbox in the end content of bottom-sheet rows. A press on a control toggles it and runs no row. Controls in end content are not a recommended pattern."

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 23f470e

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 25, 2026
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 25, 2026
@cixzhang
cixzhang marked this pull request as draft November 25, 2026 01:17
@cixzhang
cixzhang marked this pull request as ready for review November 25, 2026 01:17
@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 25, 2026
@cixzhang
cixzhang marked this pull request as draft November 25, 2026 01:22
@cixzhang
cixzhang marked this pull request as ready for review November 25, 2026 01:23
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 25, 2026
@cixzhang
cixzhang marked this pull request as draft November 25, 2026 02:17
@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 25, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 8726e03

@cixzhang
cixzhang marked this pull request as ready for review November 25, 2026 02:26

@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: one piece of required evidence is missing; the fix itself looks right.

The bottom sheet now leaves a press that starts on a control in a row's content to that control, which restores DropdownMenu FR5, and an engineering owner has approved the FR5 wording at this head.

  • Miss: hooks/useMenuPress.ts is a shared module that eight component folders import, and this pull request grows it with an option only the sheet uses, so please add the first-load gzip deltas from pnpm size:pages (base against head) for the docs, form, menu and table reference pages to the description, as architecture:component-import-boundaries INV10 requires.

This needs no code change: the numbers in the description are enough. CI's heavy suites run after review passes.

Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • Changeset: a checkbox in a sheet row's end content now toggles on a tap or a click, and a switch on a click: verified (the press check in the menu press hook, the sheet's row-content predicate, and the new unit and browser cases).
  • Changeset: a tapped switch now toggles at the release instead of about 300 ms later: verified (on the base the swallowed click leaves the switch to its 300 ms touch fallback; on the head the browser's click reaches it).
  • Changeset: the sheet leaves a press that starts on a control in a row's content to that control: verified (the sheet's row-content predicate).
  • Description, user impact and cause (no row matches the control, the release acts on nothing, the click is swallowed): verified against the sheet's row selector and the press model's click guard.
  • Description: the press check is an internal argument the public hook never forwards, and the public options are unchanged: verified (the hooks entry exports only the public hook; its options type matches the base).
  • Description: no change to Switch, no private attribute, no new Switch sentence: verified (changed files).
  • Description: FR5 already says a control in the row's content keeps its own press, and the press hook's record already lets an untracked click act: verified against the current records.
  • Description: no API, visual or default change: verified.
  • Description: the new unit cases fail before the change and fail again without the predicate: verified by the code path (not run here).
  • Description: real-browser cases for tap, click and drag in Chromium and WebKit: present in the browser spec (not run here).
  • Description: the disabled-control unit case covers only the sheet's handling: verified.
  • Description: presses on a row's icon, padding or non-control end content, headings, disabled rows and submenu chevrons behave as before: verified (the predicate answers no for them; existing cases unchanged).
  • Description: the story-description follow-up is tracked separately: verified (an open follow-up issue).
  • Description: the test, typecheck, lint and knowledge-check results: not checkable here, since CI's heavy suites have not run at this head.
  • Description: the branch merges cleanly with main: verified (the head merges current main with no overlap).

Files:

  • .changeset/sheet-row-end-content-toggle.md: clear.
  • apps/storybook/stories/DropdownMenu.stories.tsx: clear (its description caveat is tracked in the follow-up issue).
  • docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear (FR5 wording approved by an engineering owner at this head; the rest of the table is re-padding).
  • packages/core/src/DropdownMenu/MenuBottomSheetActionList.test.tsx: clear.
  • packages/core/src/DropdownMenu/MenuBottomSheetActionList.tsx: clear.
  • packages/core/src/DropdownMenu/__tests__/DropdownMenuSheetRowPress.interaction.browser.spec.ts: clear.
  • packages/core/src/hooks/useMenuPress.ts: blocking evidence gap (the four-page size report above).

Automated review (maintainer link)

Comment thread packages/core/src/hooks/useMenuPress.ts Resolved

@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's heavy suites have not run on this head yet; they run once review passes.

The bottom sheet now leaves a press that starts on a control in a row's content to that control, which restores DropdownMenu FR5, and an engineering owner approved the FR5 wording at this head. The first-load size table in the description answers the earlier request for the four reference pages: the shared press hook adds at most 56 B gzip, under the 0.3 KB allowance.

Claims and files checked

Review mode: same-head; reason: none

Claims:

  • Changeset: a checkbox in a sheet row's end content now toggles on a tap or a click, and a switch on a click: verified (the press check in the menu press hook, the sheet's row-content predicate, and the new unit and browser cases).
  • Changeset: a tapped switch now toggles at the release instead of about 300 ms later: verified (on the base the swallowed click leaves the switch to its 300 ms touch fallback; on the head the browser's click reaches it).
  • Changeset: the sheet leaves a press that starts on a control in a row's content to that control: verified (the sheet's row-content predicate and the early return in the press hook).
  • Description, user impact and cause (no row matches the control, the release acts on nothing, the click is swallowed): verified against the sheet's row selector and the press model's click guard.
  • Description: controls in end content go against the menu item docs, which call it non-interactive: verified (the item docs).
  • Description: the press check is an internal argument the public hook never forwards, and the public options are unchanged: verified (the hooks entry exports only the public hook; its options type matches the base).
  • Description: no change to Switch, no private attribute, no new Switch sentence: verified (changed files).
  • Description: FR5 already says a control in the row's content keeps its own press, and the press hook's record already lets an untracked click act: verified against the current records.
  • Description: no API, visual or default change: verified.
  • Description: the new unit cases fail before the change and again without the predicate: verified by the code path (not run here).
  • Description: real-browser cases for tap, click and drag in Chromium and WebKit: present in the browser spec (not run here).
  • Description: the disabled-control unit case covers only the sheet's handling: verified.
  • Description: presses on a row's icon, padding or non-control end content, headings, disabled rows and submenu chevrons behave as before: verified (the predicate answers no for them; existing cases unchanged).
  • Description: the story-description follow-up is tracked separately: verified (an open follow-up issue).
  • Description: first-load size on the docs, form, menu and table reference pages, +0, +0, +55 and +56 B gzip, all under the 0.3 KB limit: reported with the repository's own size command, which exists with those options; the deltas match the size of the added hook code and which pages reach it (not rerun here).
  • Description: typecheck and lint pass: verified (CI at this head); the local test counts and the knowledge check: not checkable here, since CI's heavy suites have not run at this head.
  • Description: the branch merges cleanly with main: verified (the head merges current main with no conflict).

Files:

  • .changeset/sheet-row-end-content-toggle.md: clear.
  • apps/storybook/stories/DropdownMenu.stories.tsx: clear (its description caveat is tracked in the follow-up issue).
  • docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear (FR5 wording approved by an engineering owner at this head; the rest of the table is re-padding).
  • packages/core/src/DropdownMenu/MenuBottomSheetActionList.test.tsx: clear.
  • packages/core/src/DropdownMenu/MenuBottomSheetActionList.tsx: clear.
  • packages/core/src/DropdownMenu/__tests__/DropdownMenuSheetRowPress.interaction.browser.spec.ts: clear.
  • packages/core/src/hooks/useMenuPress.ts: clear (the four-page size report is now in the description).

Automated review (maintainer link)

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 25, 2026
@cixzhang
cixzhang merged commit 749abef into meta:main Nov 25, 2026
299 of 304 checks passed
@cixzhang

Copy link
Copy Markdown
Contributor

🤖 (Posted by Cindy's agent.) Merged, thank you @bstcoc! In a DropdownMenu or ContextMenu shown as a bottom sheet, a Switch or checkbox in a row's end content now toggles once on a tap or click, right at release, without running the row. Dropping the extra drag flag made it simpler too. It ships in the next release, with you credited.

This branch was successfully deployed

1 active deployment
Preview — 8726e037 Deployed Nov 25, 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 A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DropdownMenu, ContextMenu: in a bottom sheet, a switch or checkbox in a row's endContent never toggles

2 participants