Repository navigation
fix(Item): the row's onClick ignores clicks from portals and role-based controls - #9393
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| 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
There was a problem hiding this comment.
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]
|
CI here stops at the |
7be2487 to
6cb0f33
Compare
|
Pushed 6cb0f33 (rebased onto main, which had a conflicting Item refactor in #9531).
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. |
There was a problem hiding this comment.
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]
|
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 |
There was a problem hiding this comment.
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 arole(such asrole="listitem"or"option") putsonClickstraight on its root and still runs it for a nested role-based control or portal content, so narrow the scope to "(one withonClickand norole)".
[Automated review]
|
Narrowed in the changeset and the description's User impact to "(one with |
There was a problem hiding this comment.
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
Sliderthumb in a clickable row still runs the row'sonClick(the Slider captures the pointer on its track, so the click lands outsiderole="slider"), so name only the roles the tests prove, for example "…or on a nested element withrole="tab","switch","menuitem","checkbox"or"option"that receives the click".
[Automated review]
d0de0eb to
2f201b7
Compare
|
Rebased onto current 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. |
There was a problem hiding this comment.
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]
2f201b7 to
83ffa3a
Compare
|
Rebased onto current 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. |
There was a problem hiding this comment.
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
onClickrow ran itsonClickfor 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
onClickand noroleno 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-507fails 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
onClickgoes 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
onClickand 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).
…ontent portaled out of it
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]>
2f1d987 to
1e8bb83
Compare
|
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 The description now also says that a link-rooted 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 |
There was a problem hiding this comment.
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
onClickand noroleno 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-511fails 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
onClickrow no longer runsonClickfor 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
onClickand 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).
|
Took the non-blocking point: the rebase had restored the guard's older comments in The decisions are still the owner's: the FR9 click rule, including whether it should cover link-rooted |
There was a problem hiding this comment.
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
onClickand noroleno 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-511fails 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
onClickrow no longer runsonClickfor 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
onClickand 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).
|
/approve-spec 285e511 |
|
/approve-spec 6e8d7d8 |
There was a problem hiding this comment.
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
onClickand noroleignores 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
onClickorhrefrows 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
onClickrow no longer runsonClickfor 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
onClickand a native button inendContentdoes 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.
|
(Posted by Cindy's agent.) Merged, thank you @HelloOjasMutreja! A row's |
User impact
Anyone with a clickable
ItemorListItem(one withonClickand norole) that holds another control inendContent. Arole="tab",role="switch"or other role-based control in the row also runs the row'sonClick, and so does a click in content the caller portals out of the row with its owncreatePortal. 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:
handleContainerClickskipped only targets insidebutton, 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 adiv 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:ItemFR9 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 anonClickorhrefrow with no parent-suppliedroleand 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'sonClickor follow its link.hasInteractiveAncestorandINTERACTIVE_SELECTORSinhooks/useClickableContainer.tsare the shared definition of "don't bubble this click to a clickable container", and TreeListItem uses them for the same job. The row'sonClickshould 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
handleContainerClickinItem.tsxkeeps its native check (closest('button, a, input, select, textarea')) and now also returns early when the target is outsidee.currentTarget(a portal rendered from the row) orhasInteractiveAncestor(target, e.currentTarget)is true (a nested role-based control). No new API and no visual change.A List link row (
ListItemwithhref) 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 thelinkRow()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-rootedonClickrow ran itsonClickfor 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 sharedhasInteractiveAncestorwalk the row now calls still checks layer surfaces.Mouse before and after
onClickrow (role="tab","switch","menuitem","checkbox","option"), or on content the caller portals out of the row, ran the row'sonClick. For a List link row it also followed the row's link.onClick, and a click on a native button inendContentstill does not.onClickpath 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 iscomponent:ItemFR9 (any pointer, mouse included), with the shared "don't bubble this click to a clickable container" rule (hasInteractiveAncestorandINTERACTIVE_SELECTORSinhooks/useClickableContainer.ts) as the code path, which TreeListItem already follows. Chromium, one mouse click each: arole="tab"in anonClickrow, before 1 rowonClickand 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
tab,switch,menuitem,checkbox,option) fail because the row'sonClickran.onClick, and a click on a native button inendContentstill does not (both tested).Item.test.tsx("clicks that belong to something else").Scope
Testing
npx vitest runoverpackages/core/src/Item,List,TreeListandTable, plustsc --noEmitonpackages/core, eslint and prettier via the pre-commit hook. The Item, List and TreeList suites pass.Table.perf.test.tsxfails on timing budgets in my environment with and without this change, andItem.swipeLayer.test.tsxfailed 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
component:ItemFR9) and the owner's spec approval at this head, then code review, CI and merge.Writing rubric results
Item.spec.mdFR9 (the click-rule sentence) and its verification row:Follow-up: #13483 (a test for a link-root row clicked inside portaled content).