Skip to content

fix(Item): the row's onClick ignores clicks from portals and role-based controls - #9393

Merged
cixzhang merged 5 commits into
meta:mainfrom
HelloOjasMutreja:fix/item-click-foreign-targets
Nov 21, 2026
Merged

cixzhang merged 5 commits into
meta:mainfrom
HelloOjasMutreja:fix/item-click-foreign-targets

Conversation

@HelloOjasMutreja

@HelloOjasMutreja HelloOjasMutreja commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Anyone with a clickable Item or ListItem (one with onClick and no role) that holds another control in endContent. A role="tab", role="switch" or other role-based control in the row also runs the row's onClick, and so does a click in content the caller portals out of the row with its own createPortal. For a List link row, a click in such portaled content also follows the row's link.

Problem and solution fit

Why does it happen: handleContainerClick skipped only targets inside button, a, input, select, textarea, and never checked the target was inside the row. React bubbles a click through a portal to the component that rendered it, so a row in a caller-made portal reached the row's handler, and a div role="tab" matched none of the five selectors. Why does it harm: the row's primary action fires for a click meant for something else, which can navigate away or mutate data. Why does it matter: a row with a nested menu or switch is the ordinary shape of a list. The fix makes Item answer "does this click belong to something else" the way TreeListItem and the Table row plugins already do.

Expected behavior and authority

component:Item FR9 limits an interactive row's activation to a press that would activate it: a press on the row's surface or on its own action, not one that starts on another interactive element inside the row. A one-line consistency clause in FR9 states the same rule for the click: for an onClick or href row with no parent-supplied role and no link root, a click on another interactive element inside the row, native or role-based, or in content the caller portals out of the row, does not run the row's onClick or follow its link.

hasInteractiveAncestor and INTERACTIVE_SELECTORS in hooks/useClickableContainer.ts are the shared definition of "don't bubble this click to a clickable container", and TreeListItem uses them for the same job. The row's onClick should run only for a click whose target is inside the row's own DOM and not inside a nested control, native or role-based.

Smallest restoration

handleContainerClick in Item.tsx keeps its native check (closest('button, a, input, select, textarea')) and now also returns early when the target is outside e.currentTarget (a portal rendered from the row) or hasInteractiveAncestor(target, e.currentTarget) is true (a nested role-based control). No new API and no visual change.

A List link row (ListItem with href) shares the same check, so a click in content the caller portals out of it no longer follows the row's link; a test beside the linkRow() cases covers it. Otherwise nothing else changes: a read-only input, and a row rooted on or nested in a link or button, stay inert for a click on a nested native control, exactly as before. One more change: a link-rooted onClick row ran its onClick for a click in content the caller portals out of it, and it no longer does. Tooltip and HoverCard surface presses are stopped by the layer root now (#9531), and the shared hasInteractiveAncestor walk the row now calls still checks layer surfaces.

Mouse before and after

  • Before: a mouse click on a nested role-based control in an onClick row (role="tab", "switch", "menuitem", "checkbox", "option"), or on content the caller portals out of the row, ran the row's onClick. For a List link row it also followed the row's link.
  • After: the same click runs only the control's own handler. A click on the row's label or other plain content still runs the row's onClick, and a click on a native button in endContent still does not.
  • The change is not limited to touch because the onClick path of the row's click handler does not branch on input modality: the row's action fires for a click meant for another control, with any pointer. The record line this follows is component:Item FR9 (any pointer, mouse included), with the shared "don't bubble this click to a clickable container" rule (hasInteractiveAncestor and INTERACTIVE_SELECTORS in hooks/useClickableContainer.ts) as the code path, which TreeListItem already follows. Chromium, one mouse click each: a role="tab" in an onClick row, before 1 row onClick and after 0; a note portaled from the row, before 1 and after 0; a note portaled from a List link row, before 1 link follow and after 0; a click on the row's label, before 1 and after 1.

Evidence

  • Reproduction before the change: with the source reverted, the new portal test and the five role-based tests (tab, switch, menuitem, checkbox, option) fail because the row's onClick ran.
  • Result after the change: the same tests pass.
  • Representative unchanged path: a click on the row's label still runs onClick, and a click on a native button in endContent still does not (both tested).
  • Regression test or other mutation-sensitive proof: Item.test.tsx ("clicks that belong to something else").

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

npx vitest run over packages/core/src/Item, List, TreeList and Table, plus tsc --noEmit on packages/core, eslint and prettier via the pre-commit hook. The Item, List and TreeList suites pass. Table.perf.test.tsx fails on timing budgets in my environment with and without this change, and Item.swipeLayer.test.tsx failed once under parallel load and passed alone twice. My own verification is jsdom, through the new tests; the Chromium mouse counts in the section above were not run by me, and I have not run a real browser myself. The change is event-target logic with no layout or input-modality dependence.

Fixes #8977

Owner and land path

  • Owner: @HelloOjasMutreja (author); Astryx maintainers, fix-loop lane 1, carry it to merge.
  • Land path: record consistency clause (component:Item FR9) and the owner's spec approval at this head, then code review, CI and merge.

Writing rubric results

Item.spec.md FR9 (the click-rule sentence) and its verification row:

  • R1, narration: none; the sentence states what the row does.
  • R2, research: none.
  • R3, evidence naming a change: none; the basis names dated owner directions and the verification row names tests.
  • R4, rejected alternatives: none.
  • R5, pull request or issue references: none in the edited text.
  • R6, answered open questions: none.
  • R7, project status: none.

Follow-up: #13483 (a test for a link-root row clicked inside portaled content).

@vercel

vercel Bot commented Nov 1, 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 21, 2026 2:52pm UTC

Request Review

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

astracat-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 21, 2026, 3:06 PM 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 labels Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 6e8d7d8

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Pagination 152.9 kB (+45 B) · 20.0 kB CSS (0) — — · — · —
BreadcrumbItem 102.2 kB (+44 B) · 14.0 kB CSS (0) — — · — · —
lab/Comments 387.8 kB (+44 B) · 2.5 kB CSS (0) — — · — · —
34 more components
Component Size LoC Visual · A11y · RTL
DropdownMenuSubMenu 80.4 kB (+42 B) · 11.0 kB CSS (0) — — · — · —
DropdownMenuItem 28.6 kB (+40 B) · 7.1 kB CSS (0) — — · — · —
Selector 119.8 kB (+39 B) · 19.7 kB CSS (0) — — · — · —
CheckboxListItem 82.0 kB (+38 B) · 12.5 kB CSS (0) — — · — · —
PowerSearch 317.8 kB (+38 B) · 27.3 kB CSS (0) — — · — · —
lab/TabBarMoreList 104.1 kB (+37 B) · 1.8 kB CSS (0) — — · — · —
RadioListItem 78.1 kB (+36 B) · 11.1 kB CSS (0) — — · — · —
lab/MediaVolume 223.0 kB (+36 B) · 1.5 kB CSS (0) — — · — · —
ContextMenu 104.9 kB (+35 B) · 19.6 kB CSS (0) — — · — · —
lab/MediaFullscreenButton 223.0 kB (+35 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlaybackRate 223.0 kB (+35 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlayButton 223.0 kB (+35 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaSeekButton 223.0 kB (+35 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTime 223.0 kB (+35 B) · 1.5 kB CSS (0) — — · — · —
MoreMenu 113.3 kB (+34 B) · 19.8 kB CSS (0) — — · — · —
lab/MediaCaptionsButton 223.0 kB (+34 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTimeSlider 223.0 kB (+34 B) · 1.5 kB CSS (0) — — · — · —
lab/CommentThread 380.9 kB (+33 B) · 2.4 kB CSS (0) — — · — · —
Markdown 208.1 kB (+32 B) · 23.4 kB CSS (0) — — · — · —
SelectorOption 24.6 kB (+32 B) · 6.8 kB CSS (0) — — · — · —
Item · Storybook 20.8 kB (+31 B) · 6.2 kB CSS (0) 991 (+5) ✓ · ✓ · —
lab/AudioPlayer 233.1 kB (+31 B) · 1.8 kB CSS (0) — — · — · —
lab/VideoPlayer 230.7 kB (+30 B) · 2.1 kB CSS (0) — — · — · —
Table 123.9 kB (+29 B) · 21.1 kB CSS (0) — — · — · —
ListItem 81.1 kB (+28 B) · 12.5 kB CSS (0) — — · — · —
lab/TransferList 138.7 kB (+28 B) · 1.2 kB CSS (0) — — · — · —
lab/TransferListSelector 150.6 kB (+28 B) · 1.4 kB CSS (0) — — · — · —
DropdownMenu 113.0 kB (+25 B) · 19.8 kB CSS (0) — — · — · —
TableCell 106.1 kB (+24 B) · 20.1 kB CSS (0) — — · — · —
ContextMenuItem 38.7 kB (+23 B) · 7.3 kB CSS (0) — — · — · —
DropdownMenuRadioItem 29.4 kB (+23 B) · 7.6 kB CSS (0) — — · — · —
TableHeaderCell 105.9 kB (+23 B) · 20.0 kB CSS (0) — — · — · —
DropdownMenuCheckboxItem 29.4 kB (+22 B) · 7.6 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 314.8 kB (+22 B) · 454 B CSS (0) — — · — · —

Package size: @astryxdesign/core 7.95 MB packed (+329 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.

Thanks: the fix works as described, so choosing Edit in a MoreMenu, or toggling a role="switch", inside a clickable Item or ListItem no longer also runs the row's onClick, and the new tests fail without it. Approval waits on an engineering owner, because no current spec says which clicks an Item row ignores: they need to approve or amend the four outcomes this PR ships (portal clicks and role-based controls no longer run onClick, while clicks on aria-readonly controls such as a read-only CheckboxInput, and clicks in a row rooted on or nested in <a>/<button>, now do). An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. Separately, please narrow the changeset: "or other row with onClick" also covers CheckboxListItem and RadioListItem, which this change does not touch.

[Automated review]

@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

CI here stops at the ci:run gate (lint, test, build and docsite-test report the label message), so none of those checks has run on this head. Could a maintainer add the ci:run label so they do? Locally the Item, List, MoreMenu and TreeList suites, the typecheck, eslint and prettier pass.

@HelloOjasMutreja
HelloOjasMutreja force-pushed the fix/item-click-foreign-targets branch from 7be2487 to 6cb0f33 Compare November 2, 2026 16:42
@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Pushed 6cb0f33 (rebased onto main, which had a conflicting Item refactor in #9531).

  • Outcomes: the two you flagged as new are gone. The row keeps its native check (closest('button, a, input, select, textarea'), which still sees a read-only input and a row inside a link or button), and the portal and role-based checks sit on top of it. A new test covers a read-only checkbox input in endContent. What the change ships is now just the two things the issue asks for: a click inside a portal rendered from the row, and a click on a nested role-based control, no longer run the row's onClick.
  • Changeset: it names Item and ListItem only.

The Item, List, MoreMenu and Tooltip suites pass (287 tests). The spec decision on which clicks an Item row ignores is still for an engineering owner.

@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 narrowing this: the read-only input and link-row side effects are gone, and a click on a role-based control in a clickable Item or ListItem (such as a div role="tab") no longer also runs the row's onClick. Approval still waits on an engineering owner, because no current spec says which clicks an Item row ignores: they need to approve or amend the two outcomes this PR ships, clicks in content the caller portals from the row with its own createPortal and clicks on nested role-based controls. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. Separately, please drop the MoreMenu example from the changeset, the description and the code comment: on main a click in a MoreMenu's menu already stops at the menu's layer root and never reaches the row (the new MoreMenu test passes without this change), so the changeset should name only caller-made portals and role-based controls.

[Automated review]

Comment thread packages/core/src/Item/Item.tsx Resolved
Comment thread packages/core/src/Item/Item.tsx Resolved
@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Done in e474c97: the MoreMenu example is gone from the changeset, the description and the code comment, which now name only content the caller portals out of the row with its own createPortal and role-based controls. I also removed the MoreMenu.test.tsx case, since it passes on main and so proved nothing about this change. The /approve-spec decision on the two remaining outcomes is still the open item.

@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 dropping the MoreMenu example: the changeset, description and comment now name only caller-made portals and role-based controls. Approval still waits on an engineering owner, because no current spec says which clicks an Item row ignores: they need to approve or amend the two outcomes this PR ships, where clicks in content the caller portals from the row with its own createPortal, and clicks on nested role-based controls such as role="tab", no longer run the row's onClick. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.

Please also fix:

  • The changeset and the description's User impact say "a clickable Item or ListItem (one with onClick)", but a row with a role (such as role="listitem" or "option") puts onClick straight on its root and still runs it for a nested role-based control or portal content, so narrow the scope to "(one with onClick and no role)".

[Automated review]

@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Narrowed in the changeset and the description's User impact to "(one with onClick and no role)". You are right: with a role, onClick goes straight on the root (hasParentRole ? onClick in Item.tsx), so this change does not filter those rows. The /approve-spec decision on the two outcomes is still the open item.

@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 narrowing the changeset to rows with no role. Approval still waits on an engineering owner, because no current spec says which clicks an Item row ignores: they need to approve or amend the two outcomes this PR ships, where clicks in content the caller portals from the row with its own createPortal, and clicks on nested role-based controls such as role="tab", no longer run the row's onClick. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.

Please also fix:

  • The changeset and the description's User impact promise the fix for "the rest of the shared interactive list", but a pointer click on an Astryx Slider thumb in a clickable row still runs the row's onClick (the Slider captures the pointer on its track, so the click lands outside role="slider"), so name only the roles the tests prove, for example "…or on a nested element with role="tab", "switch", "menuitem", "checkbox" or "option" that receives the click".

[Automated review]

@HelloOjasMutreja
HelloOjasMutreja force-pushed the fix/item-click-foreign-targets branch from d0de0eb to 2f201b7 Compare November 4, 2026 17:29
@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Rebased onto current main, which conflicted in Item.tsx: #9959 added cancelNestedTouchPress to the same import block, so the import list keeps it beside hasInteractiveAncestor. Nothing else changed. The diff against main is still the changeset, the three-condition check in handleContainerClick and its test.

The Item and MoreMenu suites pass (138 tests), and typecheck and strict lint are clean. Approval still waits on an engineering owner for the Item click scope.

@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 the rebase; approval still waits on an engineering owner, because no current spec says which clicks an Item row's onClick ignores.

They need to approve or amend the two outcomes this PR ships: a click on a nested role-based control such as role="tab", and a click in content the caller portals from the row with its own createPortal, no longer run the row's onClick (component:Item FR9 covers only the touch press paint). An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.

The earlier request to narrow the changeset's Slider wording no longer applies: on current main a click on a Slider thumb lands on its role="slider" element, so the row ignores it as the changeset says.

[Automated review]

@HelloOjasMutreja
HelloOjasMutreja force-pushed the fix/item-click-foreign-targets branch from 2f201b7 to 83ffa3a Compare November 5, 2026 08:36
@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Rebased onto current main, which conflicted again in Item.tsx and Item.test.tsx. #8085 moved the row's click wiring to useClickableContainerProxy and added PRESSABLE_CONTAINER_ATTRIBUTE to the same import block, and it added Activity to the test's react import. The imports keep both sides, with hasInteractiveAncestor and createPortal added back. The three-condition check in handleContainerClick is unchanged and still sits where main calls it. The diff against main is the same three files.

The Item, MoreMenu and List suites pass (234 tests), and typecheck and strict lint are clean. Approval still waits on an engineering owner for the Item click scope.

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

Approval waits on an engineering owner deciding the click rule this pull request adds to the Item record's FR9, which is the only spec authority for the two changes to onClick rows: a nested role-based control such as role="tab", and content the row portals out with createPortal, no longer run the row's onClick. An engineering owner records that decision by commenting /approve-spec <full head SHA> on the head that carries the final wording, and the author may do so if they are an engineering owner. The narrowed scope now leaves out onClick rows whose root is a link, whose portal clicks the code also changes, so that decision also covers whether the sentence should include them.

Please also fix:

  • Desktop behavior change needs an owner decision: a mouse click on a nested role-based control, or on content the row portals out, no longer runs its onClick (Item.tsx:848, Item.tsx:852), and an engineering owner's bare /approve-spec <full head SHA> on the final head settles it, or limit the change to touch input.
  • Miss: "Smallest restoration" says a row rooted on or nested in a link or button stays inert exactly as before, but a link-rooted onClick row ran its onClick for a click in content it portals out before this change and no longer does, so please say so there.

Thanks for fixing the FR9 link-root scope and the description's quote of the clause; both now match the code.

Claims and files checked

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

  • Changeset: a row with onClick and no role no longer runs it for caller portal content or a nested role-based control: verified (seven new tests fail on the base and pass here; a Chromium mouse click goes from one row action to none).
  • Changeset: a List link row no longer follows its link for portaled content: verified (Item.test.tsx:501-507 fails on the base; Chromium follows on the base, not here).
  • Changeset: the rest of the shared interactive list is covered too: verified by the shared walk the guard calls (Item.tsx:852); five roles are tested.
  • Description: the old guard skipped only native controls and never checked that the target was inside the row: verified (base Item.tsx).
  • Description: the fix answers the question the way TreeListItem and the Table row plugins do: partly; they share the role-based walk, and none checks portal containment.
  • Description: the current FR9 limits activation to a press that would activate it: partly; it states touch paint with activation as its premise.
  • Description: the quoted FR9 clause: verified (it matches Item.spec.md:117).
  • Description: the guard keeps the native check and adds containment and the shared walk: verified (Item.tsx:845-855).
  • Description: no new API and no visual change: verified (the API surface generator reports no rows; no style change).
  • Description: a List link row shares the check and a test covers it: verified (Item.test.tsx:501-507).
  • Description: a read-only input, and a row rooted on or nested in a link or button, stay inert exactly as before: false for content such a row portals out (a link-rooted row's onClick goes from one run to none); true for read-only inputs and nested controls.
  • Description: Tooltip and HoverCard presses stop at the layer root and the shared walk still checks layer surfaces: verified (useClickableContainer.ts:125-130).
  • Description: mouse before and after counts: verified in Chromium at this head.
  • Description: the change is not limited to touch because the handler does not branch on input modality: verified (Item.tsx:840-876).
  • Description: the new portal and role tests fail with the source reverted and pass with it: verified (seven tests fail on the base, the link-row case included).
  • Description: a label click still runs onClick and a native button in end content does not: verified (Item.test.tsx:2183, Item.test.tsx:2254).
  • Description: the Item, List and TreeList suites pass: verified (670 tests across Item, List, TreeList, CheckboxList, RadioList and the shared hook suites).
  • Description: the Table perf and swipe-layer failures are specific to the author's environment: not checked.
  • Description: the author's own verification is jsdom and the browser counts were not run by the author: consistent with the rest of the description.
  • Description: writing rubric results R1 to R7 report nothing: verified against the added FR9 text and verification row.
  • Description: fixes the linked issue: verified (its two reproduction clicks are the two changed cases).
  • Description: public text carries no internal context: verified.
  • .changeset/item-click-foreign-targets.md: clear.
  • docs/specs/components/Item/Item.spec.md: finding (owner decision on the FR9 sentence; link-root portal outcome outside its scope, non-blocking).
  • packages/core/src/Item/Item.test.tsx: clear.
  • packages/core/src/Item/Item.tsx: finding (desktop owner decision).

Automated review (maintainer link)

Comment thread docs/specs/components/Item/Item.spec.md Resolved
HelloOjasMutreja and others added 3 commits November 19, 2026 02:18
component:Item FR9 limits an interactive row's activation to a press that
would activate it. One consistency line now says so for the click: a
click on another control inside an onClick or href row, native or
role-based, or in content the caller portals out of the row, does not run
the row's onClick or follow its link. The verification row names the new
tests. The click guard's comments say why the native check stays.

Co-authored-by: HelloOjasMutreja <[email protected]>
@HelloOjasMutreja
HelloOjasMutreja force-pushed the fix/item-click-foreign-targets branch from 2f1d987 to 1e8bb83 Compare November 18, 2026 20:51
@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (1e8bb83); the branch had conflicted again. I rebased rather than merged so cixzhang's FR9 record commit stays as its own commit, and only the Item spec conflicted. Main had rewritten FR9 to the every-pointer press rule, so FR9 now carries main's text with the click-rule sentence appended (scoped to an onClick or href row with no parent-supplied role and no link root), and its verification row keeps main's cases and gap note with the click-rule tests added.

The description now also says that a link-rooted onClick row stops running its onClick for portaled content, which the bot pointed out. The Item, ListItem, List, CheckboxList, RadioList and useClickableContainer suites pass (654 tests) and the core typecheck is clean.

The decisions are still the owner's: the click rule in FR9, and whether a mouse click on a nested role-based control or on portaled content should run an onClick row's onClick. An approval has to name 1e8bb83.

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

Approval waits on an engineering owner deciding the click rule this pull request adds to the Item record's FR9, which is the only spec authority for the two changes to onClick rows: a nested role-based control such as role="tab", and content the row portals out with createPortal, no longer run the row's onClick. An engineering owner records that decision by commenting /approve-spec <full head SHA> on the head that carries the final wording, and the author may do so if they are an engineering owner. The sentence's scope leaves out onClick rows whose root is a link, whose portal clicks the code also changes, so that decision also covers whether the sentence should include them.

Please also fix:

  • Desktop behavior change needs an owner decision: a mouse click on a nested role-based control, or on content the row portals out, no longer runs the row's onClick (Item.tsx:861, Item.tsx:866), so it needs an engineering owner's bare /approve-spec <full head SHA> on the final head, or the change limited to touch input.

Non-blocking: the rebase restored the guard's older comments at Item.tsx:862 and Item.tsx:865, and the previous wording, which kept only the reason, is clearer.

Claims and files checked

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

  • Changeset: a row with onClick and no role no longer runs it for caller portal content or a nested role-based control: verified (seven new tests fail on the base and pass here; one Chromium mouse click goes from one row action to none).
  • Changeset: a List link row no longer follows its link for portaled content: verified (Item.test.tsx:505-511 fails on the base; Chromium follows the link on the base, not here).
  • Changeset: the rest of the shared interactive list is covered too: verified by the shared walk the guard calls (Item.tsx:866); five roles are tested.
  • Description: the old guard skipped only native controls and never checked that the target was inside the row: verified (base Item.tsx).
  • Description: the shared walk is the shared "don't bubble this click" rule, and TreeListItem uses it: verified (useClickableContainer.ts:121, TreeListItem.tsx:467).
  • Description: the fix answers the question the way TreeListItem and the Table row plugins do: partly; they share the role-based walk, and none checks portal containment.
  • Description: the current FR9 limits activation to a press that would activate it: partly; it limits press paint, from any pointer, with activation as its premise.
  • Description: the quoted FR9 click sentence: verified (it matches Item.spec.md:117).
  • Description: the guard keeps the native check and adds containment and the shared walk: verified (Item.tsx:858-869).
  • Description: no new API and no visual change: verified (the API surface generator reports no rows; no style change).
  • Description: a List link row shares the check and a test covers it: verified (Item.test.tsx:505-511).
  • Description: a read-only input, and a row rooted on or nested in a link or button, stay inert for a nested native control exactly as before: verified (the native check is unchanged and still runs for targets in the row).
  • Description: a link-rooted onClick row no longer runs onClick for content it portals out: verified (Chromium: once on the base, never here); no test covers it.
  • Description: Tooltip and HoverCard presses stop at the layer root and the shared walk still checks layer surfaces: verified (useClickableContainer.ts:118-130).
  • Description: mouse before and after counts: verified in Chromium at this head; the List link-row half holds for portaled content only, since a role-based control in a List link row already did not follow the link on the base.
  • Description: the change is not limited to touch because the handler does not branch on input modality: verified (Item.tsx:853-890).
  • Description: the new portal and role tests fail with the source reverted and pass with it: verified (seven tests fail on the base, the link-row case included).
  • Description: a label click still runs onClick and a native button in end content does not: verified (Item.test.tsx:3809, Item.test.tsx:3880).
  • Description: the Item, List and TreeList suites pass: verified (357 tests across the TreeList, CheckboxList and RadioList suites, and 415 across Item, List, the shared hook and nested-press suites, pass here).
  • Description: the Table perf and swipe-layer failures are specific to the author's environment: not checked.
  • Description: the author's own verification is jsdom and the browser counts were not run by the author: consistent with the rest of the description.
  • Description: writing rubric results R1 to R7 report nothing: verified against the added FR9 sentence and verification row.
  • Description: fixes the linked issue: verified (its two reproduction clicks are the two changed cases).
  • Description: public text carries no internal context: verified.
  • .changeset/item-click-foreign-targets.md: clear.
  • docs/specs/components/Item/Item.spec.md: finding (owner decision on the FR9 click sentence; link-root portal outcome outside its scope).
  • packages/core/src/Item/Item.test.tsx: clear.
  • packages/core/src/Item/Item.tsx: finding (desktop owner decision; comment wording, non-blocking).

Automated review (maintainer link)

Comment thread docs/specs/components/Item/Item.spec.md Resolved
@HelloOjasMutreja

Copy link
Copy Markdown
Contributor Author

Took the non-blocking point: the rebase had restored the guard's older comments in Item.tsx, so the click guard's comments are back to the clearer wording that keeps only the reason. Comments only, no behavior change.

The decisions are still the owner's: the FR9 click rule, including whether it should cover link-rooted onClick rows, and the mouse behavior on a nested role-based control or portaled content. An approval has to name 285e511.

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

Approval waits on an engineering owner deciding the click rule this pull request adds to the Item record's FR9, the only spec authority for its two changes to onClick rows (a click on a nested role-based control such as role="tab", or on content the row portals out with createPortal, no longer runs the row's onClick), including whether the rule should also cover rows whose root is a link, whose portal clicks the code changes too, and whether this ships as a patch fix. An engineering owner records that decision by commenting /approve-spec <full head SHA> on the pull request at the head that carries the final wording, and the author may do so if they are an engineering owner.

Please also fix:

  • Desktop behavior change needs an owner decision: a mouse click on a nested role-based control, or on content the row portals out, no longer runs the row's onClick (Item.tsx:861, Item.tsx:865), so it needs an engineering owner's bare /approve-spec <full head SHA> on the final head, or the change limited to touch input.

CI's test and build jobs did not run on this head because CI was full, so they still need a re-run.

Claims and files checked

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

  • Changeset: a row with onClick and no role no longer runs it for content the caller portals out or for a nested role-based control: verified (seven new tests fail on the base and pass here; one Chromium mouse click goes from one row action to none).
  • Changeset: the rest of the shared interactive list is covered too: verified by the shared walk the guard calls (Item.tsx:865); five roles are tested.
  • Changeset: a List link row no longer follows its link for portaled content: verified (Item.test.tsx:505-511 fails on the base; Chromium follows the link on the base, not here).
  • Changeset: a patch-level fix: depends on the owner's ruling on the new click rule and on whether a released consumer relies on the old clicks.
  • Description: the old guard skipped only native controls and never checked that the target was inside the row: verified (base Item.tsx).
  • Description: the shared walk is the shared rule for clicks that belong to something else, and TreeListItem uses it: verified (useClickableContainer.ts:121, TreeListItem.tsx:467).
  • Description: the fix answers the question the way TreeListItem and the Table row plugins do: partly; they share the role-based walk, and none checks portal containment.
  • Description: the current FR9 limits activation to a press that would activate it: partly; it limits press paint, from any pointer, with activation as its premise.
  • Description: the quoted FR9 click sentence: verified (it matches Item.spec.md:117).
  • Description: the guard keeps the native check and adds containment and the shared walk: verified (Item.tsx:858-868).
  • Description: no new API and no visual change: verified (no export, prop, type, default or style changes).
  • Description: a List link row shares the check and a test covers it: verified (Item.test.tsx:505-511).
  • Description: a read-only input, and a row rooted on or nested in a link or button, stay inert for a nested native control exactly as before: verified (the native check is unchanged; the read-only input test passes on both trees).
  • Description: a link-rooted onClick row no longer runs onClick for content it portals out: verified (Chromium: once on the base, never here); no test covers it.
  • Description: Tooltip and HoverCard presses stop at the layer root and the shared walk still checks layer surfaces: verified (useClickableContainer.ts:118-130).
  • Description: the mouse before-and-after counts: verified in Chromium at this head for the role-based control, both portal cases and the label.
  • Description: the change is not limited to touch because the handler does not branch on input type: verified (Item.tsx:853-889).
  • Description: the new portal and role tests fail with the source reverted and pass with it: verified (seven tests fail on the base, the List link-row case included).
  • Description: a label click still runs onClick and a native button in end content does not: verified (both tests pass on both trees; Chromium label click runs it once on each).
  • Description: the Item, List and TreeList suites pass: verified; the TreeList, CheckboxList and RadioList suites also pass here (9 files, 357 tests), beside 449 Item, List and shared-hook tests.
  • Description: the Table performance and swipe-layer failures are specific to the author's environment: not checked.
  • Description: the author's own verification is jsdom and the browser counts were not run by the author: consistent with the rest of the description.
  • Description: writing rubric results R1 to R7 report nothing: verified against the added FR9 sentence and verification row.
  • Description: no new interaction model is hidden under the fix label: verified; the click rule is stated openly and proposed for an owner decision.
  • Description: fixes the linked issue: verified (its two reproduction clicks are the two changed cases).
  • Description: public text carries no internal context: verified.
  • .changeset/item-click-foreign-targets.md: clear (the patch label follows the owner's ruling).
  • docs/specs/components/Item/Item.spec.md: finding (owner decision on the FR9 click sentence; link-root portal outcome outside its scope).
  • packages/core/src/Item/Item.test.tsx: clear.
  • packages/core/src/Item/Item.tsx: finding (desktop owner decision).

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 285e511

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 21, 2026
@cixzhang
cixzhang marked this pull request as draft November 21, 2026 14:36
@cixzhang cixzhang added lane:3 Astryx fix-loop lane 3 owns this ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 6e8d7d8

@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 has not run on this head yet because the pull request is still a draft, and it runs once the pull request is marked ready for review.

An engineering owner approved the Item record's new click rule at this head, and the change matches it: a click on a nested role-based control, or in content the row portals out, no longer runs a clickable row's onClick or follows a List link row's link. The new tests fail without the source change and pass with it, and mouse clicks in Chromium match the before-and-after results in the description. Optionally, a test for a row whose root is a link, clicked in content it portals out, would guard the one outcome the record's sentence leaves out.

Claims and files checked

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

  • Changeset: a clickable Item or ListItem with onClick and no role ignores a click in content it portals out: verified (new portal test; Chromium click).
  • Changeset: it ignores a click on a nested role-based control from the shared interactive list: verified (the guard calls the shared walk; five role tests).
  • Changeset and description: a List link row no longer follows its link for a click in content it portals out: verified (new link-row test; Chromium click).
  • Changeset: shipped as a patch fix: verified as the owner's decision at this head.
  • Description: the old guard skipped only five native selectors and never checked that the target was inside the row: verified (base Item source).
  • Description: the fix answers the question the way TreeListItem and the Table row plugins do: verified for role-based controls; the portal containment check is Item's own.
  • Description: the Item record's FR9 now states the click rule for onClick or href rows with no parent role and no link root: verified (FR9 at this head).
  • Description: the native check stays, so read-only inputs and rows inside a link or button behave as before: verified (guard source; read-only input test).
  • Description: a link-rooted onClick row no longer runs onClick for content it portals out: verified by reading the guard; no test covers it.
  • Description: layer surfaces still count in the shared walk: verified (shared hook source).
  • Description: the mouse before-and-after results and Chromium counts: verified by this review's Chromium clicks on a role tab, two portaled notes and the label.
  • Description: with the source reverted the new tests fail: verified; exactly the seven new outcome tests fail.
  • Description: a label click still runs onClick and a native button in endContent does not: verified (tests pass on both trees).
  • Description: the Item, List and TreeList suites and the typecheck pass: verified (866 tests across eight suites; the core build's type check passes); the Table and flaky-suite notes describe the author's environment and were not rerun.
  • Description: no new public API or visual change: verified (the API generator lists no rows; label frames are identical).
  • Description: fixes the linked issue: verified (the issue describes the same two cases).
  • Description: writing rubric results for the record edit: verified against the FR9 sentence and its verification row.
  • Description: public text carries no internal context: verified.
  • Description: the land path needs the owner's spec approval at this head: verified (present). The owner line is a process note, not a code claim.
  • File .changeset/item-click-foreign-targets.md: clear.
  • File docs/specs/components/Item/Item.spec.md: clear; optional: FR9's Basis cell could record the click-rule decision.
  • File packages/core/src/Item/Item.test.tsx: clear; optional: no test for the link-root portal outcome.
  • File packages/core/src/Item/Item.tsx: clear.

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 21, 2026
@cixzhang
cixzhang merged commit 5a3a9f3 into meta:main Nov 21, 2026
207 of 210 checks passed
@cixzhang

Copy link
Copy Markdown
Contributor

(Posted by Cindy's agent.) Merged, thank you @HelloOjasMutreja! A row's onClick now ignores clicks that come from content a caller portals out of the row and from role-based controls inside it (tabs, switches and the like), so a row's main action only fires when someone actually clicks the row. It ships in the next release, with you credited. One related case is tracked in #13483.

This branch was successfully deployed

1 active deployment
Preview — 6e8d7d86 Deployed Nov 21, 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) lane:3 Astryx fix-loop lane 3 owns this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ListItem: the row's onClick runs for clicks in a caller's portal and on role-based controls

2 participants