Repository navigation
fix(Layer): a press inside a layer stops at the layer root in the React tree - #9497
Conversation
…ct tree architecture:layer-runtime INV17. One seam, Layer/layerClickBoundary.ts, gives every layer content root (both useLayer renderers; the Dialog, Drawer, Lightbox, MobileNav, BottomSheetPanel and ToastViewport roots) a handler per pointer, mouse, touch and click event. Each runs the root's own and its caller's handler, then marks the synthetic event stopped for the rest of the React tree (isPropagationStopped), without calling the native stopPropagation(): ancestors of the layer's JSX position no longer receive the press in bubble, capture handlers still run, and document and window listeners (outside presses, light dismiss, deferred clicks) still receive it. Dialog's inline mode layers nothing and is not a root. SelectableCard keeps component:SelectableCard FR2's released promise until the next minor (CLN-0026): a capture-phase handler on the card root calls the caller's onClick for a click that starts inside a layer within the card, without toggling. Records: layer-runtime states INV17 met, names the seam in Owning code and the new suite in verified_by; SelectableCard's compatibility and current-state lines describe the capture-phase path and add CLN-0026. Tests (layerClickBoundary.test.tsx): every kind of root inside a plain onClick wrapper and inside a ClickableCard; a nested layer stops at its own root; capture still runs and a document listener still sees the click; a root's own onClick runs first; ContextMenu's outside mousedown, a Typeahead's deferred document click and the keep-open pointerup still work for presses inside a layer (they fail if the stop is native); the SelectableCard compatibility path.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
… a clickable card Shows INV17 in a real browser: choosing a menu item or clicking popover text counts in the layer and does not activate the card around it.
|
/approve-spec 74e454d |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| MoreMenu | 71.1 kB (+304 B) · 15.4 kB CSS (0) | — | — · — · — |
| DropdownMenu | 70.8 kB (+303 B) · 15.4 kB CSS (0) | — | — · — · — |
| ContextMenu | 73.0 kB (+291 B) · 15.3 kB CSS (0) | — | — · — · — |
115 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableCell | 74.2 kB (+287 B) · 15.8 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 73.8 kB (+283 B) · 15.5 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 219.5 kB (+280 B) · 454 B CSS (0) | — | — · — · — |
| PowerSearch | 180.0 kB (+268 B) · 20.5 kB CSS (0) | — | — · — · — |
| DateTimeInput | 111.0 kB (+264 B) · 15.8 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 78.6 kB (+258 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/Comments | 229.8 kB (+257 B) · 2.5 kB CSS (0) | — | — · — · — |
| Table | 82.9 kB (+254 B) · 16.0 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 100.1 kB (+253 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/MobilePowerSearch | 164.4 kB (+253 B) · 1.2 kB CSS (0) | — | — · — · — |
| RadioList | 41.1 kB (+251 B) · 8.3 kB CSS (0) | — | — · — · — |
| lab/TransferList | 72.3 kB (+249 B) · 1.7 kB CSS (0) | — | — · — · — |
| DateInput | 98.7 kB (+247 B) · 15.3 kB CSS (0) | — | — · — · — |
| SideNav | 63.4 kB (+245 B) · 10.9 kB CSS (0) | — | — · — · — |
| Markdown | 143.6 kB (+241 B) · 18.3 kB CSS (0) | — | — · — · — |
| charts/ChartTooltip | 50.3 kB (+237 B) · 20 B CSS (0) | — | — · — · — |
| CheckboxList | 41.5 kB (+235 B) · 8.6 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 224.5 kB (+235 B) · 2.4 kB CSS (0) | — | — · — · — |
| charts/Chart | 60.9 kB (+234 B) · 20 B CSS (0) | — | — · — · — |
| BottomSheet | 35.0 kB (+232 B) · 7.5 kB CSS (0) | — | — · — · — |
| charts/ChartLegend | 50.4 kB (+230 B) · 20 B CSS (0) | — | — · — · — |
| Dialog | 16.6 kB (+230 B) · 6.6 kB CSS (0) | — | — · — · — |
| Pagination | 84.1 kB (+229 B) · 15.9 kB CSS (0) | — | — · — · — |
| Drawer | 34.3 kB (+228 B) · 8.2 kB CSS (0) | — | — · — · — |
| LayerProvider | 60.8 kB (+228 B) · 10.5 kB CSS (0) | — | — · — · — |
| TopNav | 49.5 kB (+228 B) · 10.7 kB CSS (0) | — | — · — · — |
| SelectableCard · Storybook | 14.5 kB (+227 B) · 7.3 kB CSS (0) | 355 (+50) | — · — · — |
| AlertDialog | 53.8 kB (+225 B) · 12.7 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 62.8 kB (+225 B) · 773 B CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 63.3 kB (+225 B) · 1.1 kB CSS (0) | — | — · — · — |
| lab/Schedule | 57.8 kB (+224 B) · 3.9 kB CSS (0) | — | — · — · — |
| lab/TourStep | 51.8 kB (+223 B) · 590 B CSS (0) | — | — · — · — |
| CommandPalette | 48.2 kB (+222 B) · 12.2 kB CSS (0) | — | — · — · — |
| DateRangeInput | 67.6 kB (+222 B) · 11.7 kB CSS (0) | — | — · — · — |
| Selector | 75.0 kB (+222 B) · 15.6 kB CSS (0) | — | — · — · — |
| MobileNav | 48.0 kB (+221 B) · 10.4 kB CSS (0) | — | — · — · — |
| MultiSelector | 70.9 kB (+221 B) · 15.2 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 36.3 kB (+220 B) · 6.5 kB CSS (0) | — | — · — · — |
| Tokenizer | 67.8 kB (+220 B) · 17.1 kB CSS (0) | — | — · — · — |
| Popover | 46.5 kB (+218 B) · 12.4 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 52.8 kB (+217 B) · 10.2 kB CSS (0) | — | — · — · — |
| lab/InfoTip | 23.4 kB (+216 B) · 458 B CSS (0) | — | — · — · — |
| StatusDot | 20.4 kB (+215 B) · 6.3 kB CSS (0) | — | — · — · — |
| lab/MobileTokenizer | 99.0 kB (+215 B) · 880 B CSS (0) | — | — · — · — |
| RadioListItem | 49.5 kB (+212 B) · 10.1 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 49.4 kB (+212 B) · 11.5 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 53.5 kB (+210 B) · 10.4 kB CSS (0) | — | — · — · — |
| ListItem | 51.0 kB (+210 B) · 11.0 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 53.5 kB (+209 B) · 10.4 kB CSS (0) | — | — · — · — |
| TabList | 35.4 kB (+209 B) · 7.5 kB CSS (0) | — | — · — · — |
| Toolbar | 34.7 kB (+208 B) · 7.9 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 51.4 kB (+208 B) · 11.2 kB CSS (0) | — | — · — · — |
| lab/ListInput | 80.0 kB (+208 B) · 1.6 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 64.9 kB (+205 B) · 11.4 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 44.5 kB (+205 B) · 1.2 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 51.6 kB (+203 B) · 11.0 kB CSS (0) | — | — · — · — |
| Field | 39.6 kB (+203 B) · 8.3 kB CSS (0) | — | — · — · — |
| Lightbox · Storybook | 48.3 kB (+203 B) · 10.1 kB CSS (0) | 819 (+4) | — · — · — |
| Link | 40.2 kB (+203 B) · 7.9 kB CSS (0) | — | — · — · — |
| Carousel | 47.3 kB (+202 B) · 10.5 kB CSS (0) | — | — · — · — |
| InputGroup | 40.2 kB (+202 B) · 8.4 kB CSS (0) | — | — · — · — |
| TextArea | 45.2 kB (+202 B) · 9.8 kB CSS (0) | — | — · — · — |
| TimeInput | 86.5 kB (+201 B) · 14.3 kB CSS (0) | — | — · — · — |
| AppShell | 65.8 kB (+200 B) · 12.1 kB CSS (0) | — | — · — · — |
| SegmentedControl | 34.2 kB (+199 B) · 6.5 kB CSS (0) | — | — · — · — |
| FieldLabel | 33.3 kB (+198 B) · 5.9 kB CSS (0) | — | — · — · — |
| AvatarGroup | 35.2 kB (+197 B) · 6.6 kB CSS (0) | — | — · — · — |
| Switch | 45.2 kB (+197 B) · 9.7 kB CSS (0) | — | — · — · — |
| Thumbnail | 47.5 kB (+197 B) · 11.3 kB CSS (0) | — | — · — · — |
| Toast · Storybook | 56.7 kB (+197 B) · 10.1 kB CSS (0) | 1,515 (+2) | — · — · — |
| TopNavMenu | 55.2 kB (+197 B) · 10.5 kB CSS (0) | — | — · — · — |
| CheckboxInput | 46.9 kB (+196 B) · 9.7 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 68.1 kB (+196 B) · 722 B CSS (0) | — | — · — · — |
| ChatSendButton | 42.4 kB (+195 B) · 9.5 kB CSS (0) | — | — · — · — |
| NumberInput | 53.1 kB (+195 B) · 11.2 kB CSS (0) | — | — · — · — |
| TextInput | 50.8 kB (+195 B) · 10.9 kB CSS (0) | — | — · — · — |
| Typeahead | 60.6 kB (+195 B) · 11.8 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 274.3 kB (+195 B) · 2.6 kB CSS (0) | — | — · — · — |
| Calendar | 52.2 kB (+194 B) · 10.3 kB CSS (0) | — | — · — · — |
| ComplexSelector | 53.5 kB (+193 B) · 11.1 kB CSS (0) | — | — · — · — |
| Tooltip | 18.2 kB (+193 B) · 5.0 kB CSS (0) | — | — · — · — |
| Slider | 44.4 kB (+192 B) · 8.9 kB CSS (0) | — | — · — · — |
| ToggleButton | 40.5 kB (+192 B) · 9.6 kB CSS (0) | — | — · — · — |
| Avatar | 32.4 kB (+191 B) · 6.5 kB CSS (0) | — | — · — · — |
| ChatLayout | 45.7 kB (+191 B) · 10.3 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 43.1 kB (+191 B) · 9.9 kB CSS (0) | — | — · — · — |
| DialogHeader | 45.6 kB (+191 B) · 10.2 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 55.9 kB (+191 B) · 9.9 kB CSS (0) | — | — · — · — |
| IconButton | 39.6 kB (+191 B) · 9.5 kB CSS (0) | — | — · — · — |
| TabMenu | 52.4 kB (+191 B) · 10.4 kB CSS (0) | — | — · — · — |
| ChatComposer | 58.9 kB (+189 B) · 11.2 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 254.8 kB (+189 B) · 2.3 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 43.2 kB (+188 B) · 9.8 kB CSS (0) | — | — · — · — |
| CodeBlock | 57.0 kB (+187 B) · 11.1 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 43.0 kB (+187 B) · 9.7 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 43.4 kB (+187 B) · 9.8 kB CSS (0) | — | — · — · — |
| Banner | 44.6 kB (+185 B) · 10.3 kB CSS (0) | — | — · — · — |
| Button | 39.6 kB (+185 B) · 9.5 kB CSS (0) | — | — · — · — |
| SideNavHeading | 55.9 kB (+185 B) · 10.5 kB CSS (0) | — | — · — · — |
| SideNavItem | 51.8 kB (+185 B) · 10.4 kB CSS (0) | — | — · — · — |
| Stepper | 44.2 kB (+185 B) · 9.9 kB CSS (0) | — | — · — · — |
| FileInput | 51.8 kB (+184 B) · 10.7 kB CSS (0) | — | — · — · — |
| TopNavHeading | 55.3 kB (+183 B) · 10.4 kB CSS (0) | — | — · — · — |
| DrawerHeader | 45.7 kB (+181 B) · 11.6 kB CSS (0) | — | — · — · — |
| HoverCard | 18.5 kB (+180 B) · 5.0 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 25.8 kB (+1 B) · 9.3 kB CSS (0) | — | — · — · — |
| Timestamp | 21.3 kB (+1 B) · 9.9 kB CSS (0) | — | — · — · — |
| BottomSheetSwitcher | 15.0 kB (0) · 3.4 kB CSS (0) | — | — · — · — |
| ChatMessageList | 22.7 kB (0) · 7.9 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 26.6 kB (0) · 8.5 kB CSS (0) | — | — · — · — |
| Heading | 7.9 kB (0) · 6.0 kB CSS (0) | — | — · — · — |
| Spinner | 18.5 kB (0) · 6.7 kB CSS (0) | — | — · — · — |
| Text | 7.4 kB (0) · 6.0 kB CSS (0) | — | — · — · — |
| Timer | 9.5 kB (0) · 7.0 kB CSS (0) | — | — · — · — |
| ProgressBar | 7.9 kB (−1 B) · 6.9 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 5.85 MB packed (+5.3 kB); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: core 5 rows; run pnpm api:report.
Wide change (8 components): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: the layer click boundary matches INV17 and the spec approval covers the SelectableCard path, but two regressions need fixing first.
- A
SelectableCardwhoseonClickcallsstopPropagation()now cancels clicks on menus and popovers inside the card, because the compatibility call runs during capture; please keep that stop from reaching the layer and add a test. BottomSheetSwitcher's forwardedonClickandonPointerDownno longer fire for presses on sheet content, as its FR9 promises they will; please hand them to the panel's boundary and add a test.- The menu example in the description and the
PressInsideLayerstory comment does not reproduce withClickableCard, which already ignored menu items, so please reword it to the popover-text case.
[Automated review]
| } | ||
| const layer = target.closest('[popover], dialog'); | ||
| if (layer != null && !layer.contains(e.currentTarget)) { | ||
| onClickProp(e); |
There was a problem hiding this comment.
This runs during capture, before the layer's own handlers, so a caller onClick that calls event.stopPropagation() now stops the press before it reaches a menu item or popover control inside the card. In Chromium, a MoreMenu item in such a card stops working. Consider calling the caller's handler with stopPropagation() neutralised for this call, and asking the seam for layer roots rather than closest('[popover], dialog'), which also double-calls onClick for a caller-authored popover.
| )} | ||
| // A press inside the sheet stops at its root (layer-runtime INV17), | ||
| // after the caller's handlers run. | ||
| {...layerClickBoundary(props)}> |
There was a problem hiding this comment.
In a BottomSheetSwitcher, the switcher's forwarded handlers sit on the step's <dialog>, the parent of this panel (BottomSheet.tsx around line 1182). Stopping here means a switcher onClick or onPointerDown no longer fires for presses on sheet content, which FR9 promises. Those handlers need composing into this boundary for switcher steps.
…dlers still receive presses The boundary sat on BottomSheetPanel, inside the dialog that a BottomSheetSwitcher forwards its handlers to (component:BottomSheetSwitcher FR9), so a switcher onClick or onPointerDown stopped firing for presses on sheet content. The boundary now sits on both BottomSheet dialogs (the single sheet's and a switcher step's), composing the switcher's forwarded handlers and the dialog's own; layer-runtime names that dialog as the panel's root. Test: the switcher's handlers receive a press on step content and a wrapper around the switcher does not (fails with the panel placement).
…seam and ignores a caller's stop
- The boundary marks every layer root through a private attribute owned by
privateAttributes/layerRoot.stylex.ts; SelectableCard's capture-phase
path asks closestLayerRoot instead of closest('[popover], dialog'), so a
popover the caller writes themselves is not a layer and its click reaches
onClick once, in bubble.
- In capture, a caller's stopPropagation() would keep the press from the
control inside the layer; it is a no-op for that call.
- SelectableCard's current-state line and layer-runtime's Owning code say
so. Tests: a caller stop does not block a control in the layer; a
caller-written popover calls onClick once (both fail with the previous
path).
|
/approve-spec ec06267 |
There was a problem hiding this comment.
Changes requested: the layer click boundary matches INV17, the spec approval covers the BottomSheet root and the SelectableCard capture path, and the earlier SelectableCard and BottomSheetSwitcher regressions are fixed and tested. Two small fixes remain:
- Add
onGotPointerCaptureandonLostPointerCapturetoBOUNDARY_EVENTS: INV17 covers every pointer event, and a wrapper around a popover still receives those two from inside it, so please assert them in the wrapper test too. - The changeset says a click inside a layer in a
SelectableCard"still does not toggle the card", but on the base a click on popover text did toggle it; please describe this as a change, and fix "as before" in the description.
[Automated review]
| const BOUNDARY_EVENTS = [ | ||
| 'onClick', | ||
| 'onAuxClick', | ||
| 'onDoubleClick', | ||
| 'onContextMenu', | ||
| 'onMouseDown', | ||
| 'onMouseUp', | ||
| 'onMouseMove', | ||
| 'onMouseOver', | ||
| 'onMouseOut', | ||
| 'onPointerDown', | ||
| 'onPointerUp', | ||
| 'onPointerMove', | ||
| 'onPointerOver', | ||
| 'onPointerOut', | ||
| 'onPointerCancel', | ||
| 'onTouchStart', | ||
| 'onTouchMove', | ||
| 'onTouchEnd', | ||
| 'onTouchCancel', | ||
| ] as const; |
There was a problem hiding this comment.
onGotPointerCapture and onLostPointerCapture are missing here. Both bubble through the React tree, so a wrapper around a popover still runs its handler when a slider or drag handle inside the layer takes or releases pointer capture, which INV17 ("a pointer, mouse, touch, or click event") rules out. Adding both props, and asserting them in the wrapper test, closes it.
…capture; changeset names SelectableCard's toggle change Both bubble through the React tree, so a wrapper around a layer still ran its handler when a control inside took or released pointer capture. The wrapper test now asserts both (fails without them). The changeset says a click inside an open layer within a SelectableCard no longer toggles it, which the base did for popover content.
|
/approve-spec 7141816 |
There was a problem hiding this comment.
Changes requested: the layer click boundary matches INV17 at every root, and the pointer-capture and changeset fixes are in. One fix remains:
SelectableCardcalls the caller'sonClickduring capture without shieldingpreventDefault(), so a caller that calls it now cancels aButton'sclickActioninside a popover in the card, which ran before; please forward that call to the native event only, asstopPropagation()is already shielded, and add a test.- The description still says such a click doesn't toggle the card "as before", but on the base a click on popover text did toggle it; please reword it.
[Automated review]
| const stopPropagation = e.stopPropagation; | ||
| e.stopPropagation = () => {}; | ||
| try { | ||
| onClickProp(e); | ||
| } finally { | ||
| e.stopPropagation = stopPropagation; |
There was a problem hiding this comment.
This shields stopPropagation(), but a caller onClick that calls preventDefault() still runs before the layer's handlers and marks the event cancelled for them: a Button inside the popover then skips its clickAction (Button.tsx checks !e.defaultPrevented), which ran before this change. Forwarding the caller's preventDefault() to e.nativeEvent.preventDefault() for this call keeps the native default cancelled without the layer's handlers seeing it; a test with a clickAction Button inside the popover would pin it.
…ath no longer cancels controls inside the layer; comments give reasons only - The capture-phase call ran the caller's onClick before the layer's own handlers, so its preventDefault() marked the press handled and a Button inside the popover skipped its clickAction. callBeforeLayerHandlers now records the caller's preventDefault() and applies it to the native event once the press reaches the document, where it still cancels the browser's default; stopPropagation() stays a no-op. SelectableCard's current-state line says so. Test: a clickAction Button in a popover runs, and the click is still cancelled (fails before). - New comments give reasons only, without record citations (architecture:knowledge-contracts INV29, now on main); the records link these files.
|
/approve-spec 9a858e2 |
There was a problem hiding this comment.
This looks ready to merge: the layer click boundary meets the layer runtime's INV17 at every root, the spec changes are approved at this head, and the earlier SelectableCard preventDefault() issue is fixed and tested. A few optional follow-ups:
SelectableCardruns its compatibilityonClickbefore a caller's ownonClickCapture, so a caller that stops propagation there no longer keepsonClickfrom running for clicks inside a layer; calling the caller's capture handler first and skipping when propagation is stopped keeps the released order.- A few new comments could be trimmed: the
layerClickBoundary.tsheader repeats the function JSDoc, one sentence incallBeforeLayerHandlersruns to 41 words, and the repeated "Presses inside the … do not reach handlers" lines restate the helper.
[Automated review]
| onClickCapture={ | ||
| !isDisabled && handleLayerClickCapture | ||
| ? (e: MouseEvent<HTMLDivElement>) => { | ||
| handleLayerClickCapture(e); | ||
| props.onClickCapture?.(e); | ||
| } | ||
| : props.onClickCapture | ||
| }> |
There was a problem hiding this comment.
Non-blocking: the compatibility call runs before the caller's own onClickCapture. A caller whose onClickCapture calls stopPropagation() used to keep onClick from running for a click inside a layer in the card; now onClick runs anyway. Calling props.onClickCapture?.(e) first and skipping handleLayerClickCapture when e.isPropagationStopped() keeps the released order.
| * A press that starts inside a layer runs the handlers inside the layer and | ||
| * the root's own, then stops propagating through the React tree, so no | ||
| * bubble-phase handler on an ancestor of the layer's JSX position receives it. | ||
| * Capture-phase handlers on those ancestors already ran. The stop is | ||
| * React-only: it marks the synthetic event stopped and never calls the | ||
| * native `stopPropagation()`, so document and window listeners (outside | ||
| * presses, light dismiss, deferred clicks) still receive the press. |
There was a problem hiding this comment.
Non-blocking: this paragraph repeats the JSDoc on layerClickBoundary and stopInReactTree and takes the header to 17 lines. Keeping @file, @input, @output and @position is enough.
| * so it does nothing here. Its preventDefault() would mark the event handled | ||
| * for those controls (a Button skips its clickAction), so it is applied to | ||
| * the native event only after the press has bubbled to the document, where it | ||
| * still cancels the browser's default action. |
There was a problem hiding this comment.
Non-blocking: this is one 41-word passive sentence. A shorter form: "Its preventDefault() would make those controls skip their work, as a Button skips its clickAction. So the call waits until the press reaches the document. There it cancels only the browser's default action."
User impact
onClickbehavior until the next minor, though it now runs earlier (see Changes).Spec
Builds
architecture:layer-runtimeINV17 (record merged in #9398). Specs ruled on the SelectableCard compatibility path: a capture-phase path, with no exemption and no hold. These records need/approve-spec:architecture:layer-runtime:Layer/layerClickBoundary.ts, with BottomSheetPanel's root being the BottomSheet dialog that hosts it;CLN-0026;verified_byadds the new suite.component:SelectableCard:onClickstill runs for those clicks, during capture, so before the layer's own handlers; itsstopPropagation()doesn't keep the press from the layer, itspreventDefault()cancels only the browser's default, and a caller-written popover isn't a layer;CLN-0026removes that handler at the minor, the staged[breaking]change.Changes
Layer/layerClickBoundary.ts(new, internal):layerClickBoundary(ownProps)returns one handler for each pointer, mouse, touch and click event.event.isPropagationStopped = () => trueon the synthetic event.stopPropagation()is never called.useLayerrenderers, and the Dialog (modal), Drawer, Lightbox, MobileNav and ToastViewport roots. For BottomSheetPanel it's the BottomSheet dialog that hosts the panel (single sheet and switcher step), so a BottomSheetSwitcher's forwarded handlers still receive presses on sheet content (component:BottomSheetSwitcherFR9). ExistingonClickhandlers and caller rest props are composed, not overridden.privateAttributes/layerRoot.stylex.ts(public-component-api INV23), marks each root.closestLayerRoot()reads it.SelectableCard: a capture-phase handler on the card root calls the caller'sonClickfor a click that starts inside a layer within the card. That click doesn't toggle the card, as before. It's marked forCLN-0026.closestLayerRoot(), so a popover the caller writes themselves isn't a layer and callsonClickonce, in bubble.stopPropagation()is a no-op for that call, so it can't block the control inside the layer.preventDefault()is applied to the native event only once the press reaches the document. AButtoninside the layer still runs itsclickAction, and the browser's default stays cancelled.[fix]patch. It notes that a click inside an open layer within a SelectableCard no longer toggles the card, and that the caller'sonClicknow runs earlier, during capture.Writing rubric results
layer-runtime.md: the INV17 state paragraph, the Owning-code line andverified_by.SelectableCard.spec.md: the compatibility class, the current-state bullet andCLN-0026.layerClickBoundary.test.tsx.Evidence
layerClickBoundary.test.tsx, 27 tests:onClick,onPointerDown,onGotPointerCaptureandonLostPointerCapture, and inside aClickableCard. A press inside reaches neither. The roots are an inline and a portaleduseLayerlayer, Dialog, Drawer, Lightbox, MobileNav, BottomSheetPanel and ToastViewport.onClickruns before the stop.onClickruns once for a click in an open tooltip, without toggling, and a surface click still toggles. A caller's stop doesn't block a control in the layer. A caller'spreventDefault()doesn't cancel aButton'sclickActionthere, and the click still ends cancelled. A caller-written popover callsonClickonce.onClick/onPointerDownreceive a press on step content, and a wrapper around the switcher doesn't.stopPropagation()stop, the three listener tests and the document-click assertion fail.Other checks:
check:knowledgeandcheck:changesetsare clean.