Repository navigation
spec(layer-runtime): a click inside a layer stops at the layer root - #9398
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 0616399 |
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Requesting changes: the INV17 direction is owner-approved, but the record leaves two current specs contradicting it. Please amend component:SelectableCard FR2, which still promises that a caller onClick runs for a click inside an open Tooltip or HoverCard, and revisit the patch [fix] class, which conflicts with spec:AST-017 FR1, FR5 and FR32 because the record itself gives affected app wrappers a migration. While you are in there, scope INV17's "no ancestor … receives it" to bubble-phase handlers, since an ancestor's capture-phase handler (ChatComposer's onPointerDownCapture, for example) runs before any stop at the layer root can act.
[Automated review]
| the layer, then stops propagating through the React tree: no ancestor of the | ||
| layer's JSX position receives it, including a caller's own element. A nested |
There was a problem hiding this comment.
React runs an ancestor's capture-phase handlers before anything inside the layer, so a stop at the layer root cannot keep them out. Core already has such ancestors: ChatComposer's body onPointerDownCapture and Item's swipe onClickCapture, which can even stop the click before the layer's own handlers run. Suggest scoping this sentence to bubble-phase handlers and saying capture-phase handlers on ancestors still run first; the INV17 verification row's failure signal needs the same scope.
| `component:HoverCard` FR11). Compatibility: closing the gap is a patch | ||
| `[fix]`. Propagation across a layer boundary is not intended behavior, so a | ||
| caller's ancestor handler receiving clicks from inside a layer is the defect; | ||
| an app wrapper that relied on it attaches its handler to the layer content | ||
| instead. |
There was a problem hiding this comment.
component:SelectableCard FR2 still documents the behavior this removes: a caller onClick runs for clicks that do not toggle, including a click inside an open Tooltip or HoverCard surface. The migration sentence here concedes that some consumers must change source. Under spec:AST-017 FR1, FR5 and FR32 that makes it a [breaking] correction rather than a patch [fix]. Please reclassify it or narrow the patch claim, and amend SelectableCard FR2 in this PR.
…rs; the patch class is the owner's ruling; SelectableCard FR2 cites INV17
|
/approve-spec a4a63b3 |
There was a problem hiding this comment.
Requesting changes: INV17's direction is owner-approved at this head, but its release class still conflicts with the release-compatibility spec. The record calls closing the gap a patch [fix] because "no record ever promised" that a press inside a layer reaches the layer's JSX ancestors, yet component:SelectableCard FR2 as released in 0.7.5 says a caller onClick "also runs for clicks that do not toggle", which this PR has to amend. Under spec:AST-017 FR5, FR32–FR34 and DEC-11 that is a correction with a released victim, so please class it [breaking] (staged while main declares a patch) or narrow the patch claim to callers no released record covered.
- Mark SelectableCard FR2's new layer exception as an implementation gap, since the component still calls the caller
onClickfor those clicks. - Scope the INV17 change-coupling bullet and verification row to bubble-phase handlers, matching INV17.
- Update the description's Decision bullet and Changed records to match the record.
[Automated review]
| `component:HoverCard` FR11). Compatibility: the owner ruled on 2026-11-01 | ||
| that closing the gap ships as a patch `[fix]` (`spec:AST-017` FR5's fix | ||
| class): no record ever promised that a press inside a layer reaches the | ||
| layer's JSX ancestors, so that propagation is the defect the fix removes, not | ||
| a supported behavior with a migration. A handler that needs presses inside a | ||
| layer belongs on the layer content. |
There was a problem hiding this comment.
A released record did promise this: component:SelectableCard FR2 in 0.7.5 says the caller onClick "also runs for clicks that do not toggle", and this PR has to amend FR2 to drop clicks inside a layer. Under spec:AST-017 FR5, FR32–FR34 and DEC-11 that makes closing the gap a correction with a released victim ([breaking], staged per FR34 while main declares a patch), and FR6 says engineering approval cannot make it nonbreaking. Please reclassify it or narrow the patch claim, and drop the "no record ever promised" premise.
| | ID | Invariant | Basis | | ||
| | --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | | ||
| | FR1 | SelectableCard renders `component:Card` with the given `variant`, `elevation`, `padding`, and sizing. The root also carries the `selectable-card` target reflecting `variant` and `selected`, and the first child is a visually hidden native `input type="checkbox"` named by `label` with `checked` equal to `isSelected`. | Current source and tests | | ||
| | FR2 | While enabled, a click on the card surface, a click or Space on the checkbox, or Enter on the checkbox calls `onChange(!isSelected)` exactly once. A click that belongs to nested interactive content, an open Tooltip or HoverCard surface (`component:Tooltip` FR11), or selected text does not toggle. A caller `onClick` runs after the toggle for a surface click, before it for a click or Space on the checkbox, and not at all for Enter; it also runs for clicks that do not toggle, except a click inside an open layer, which stops at the layer root (`architecture:layer-runtime` INV17). A caller `onMouseUp` runs after the card's own handling. | Current source and tests | |
There was a problem hiding this comment.
This exception is not shipped: SelectableCard.tsx still calls the caller onClick for a click inside an open layer, and INV17 is "not built". Since the record says it "records shipped behavior", please add an Implementation gap: not yet built … (Current-state impact) note here and a matching Current-state impact bullet.
| - A change to a layer content root or to the INV17 seam verifies that a press | ||
| inside each kind of root reaches no ancestor handler and still reaches | ||
| document listeners and light dismiss. |
There was a problem hiding this comment.
INV17 now lets capture-phase ancestors receive the press, so "reaches no ancestor handler" contradicts it (Core has onPointerDownCapture on ChatComposer's body and a swipe onClickCapture on Item). Suggest "reaches no bubble-phase ancestor handler" here and in the INV17 verification row's failure signal.
…ectableCard's released onClick promise staged for the next minor; bubble-phase wording
|
/approve-spec 866b648 |
There was a problem hiding this comment.
Requesting changes: INV17's direction and its release tiers are settled at this head, but three pieces of text still disagree with the approved rule.
- SelectableCard FR2 now stages a
[breaking]change for the next minor, yet the record's Compatibility and migration section, its Builder impact and Compatibility/readiness cells, and Current-state impact still say there is no change or migration; please state the staged change and its migration there. - The INV17 verification row still fails on "an ancestor handler"; please scope it to bubble-phase handlers, since INV17 lets capture-phase ancestors receive the press.
- The description's INV17 Decision bullet says no ancestor receives the press; please match the record's bubble-phase wording.
[Automated review]
| | ID | Invariant | Basis | | ||
| | --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | | ||
| | FR1 | SelectableCard renders `component:Card` with the given `variant`, `elevation`, `padding`, and sizing. The root also carries the `selectable-card` target reflecting `variant` and `selected`, and the first child is a visually hidden native `input type="checkbox"` named by `label` with `checked` equal to `isSelected`. | Current source and tests | | ||
| | FR2 | While enabled, a click on the card surface, a click or Space on the checkbox, or Enter on the checkbox calls `onChange(!isSelected)` exactly once. A click that belongs to nested interactive content, an open Tooltip or HoverCard surface (`component:Tooltip` FR11), or selected text does not toggle. A caller `onClick` runs after the toggle for a surface click, before it for a click or Space on the checkbox, and not at all for Enter; it also runs for clicks that do not toggle, including a click inside an open Tooltip or HoverCard surface. At the next minor, staged as `[breaking]`, a click inside an open layer stops at the layer root and the caller `onClick` no longer receives it (`architecture:layer-runtime` INV17); implementation gap: not built. A caller `onMouseUp` runs after the card's own handling. | Current source and tests | |
There was a problem hiding this comment.
FR2 now stages a [breaking] change for the next minor, but this record still says "Migration decision: none" and "records shipped behavior" under Compatibility and migration, "Builder impact: None" in the glance table, and lists only two gaps under Current-state impact. Please state the staged change and its migration (move a handler that needs those clicks onto the layer content) there, and add a Current-state impact bullet for this gap.
| | INV9 | Representative Dialog, ContextMenu, Tooltip/HoverCard, and BottomSheet source/tests | A current local channel silently changes ownership or policy | | ||
| | INV10 | `LayerProvider.tsx`, `LayerProvider.test.tsx`, `useToast.tsx`, `ToastViewport.test.tsx`, and `ToastViewport.modalHost.test.tsx` | Provider begins relocating ordinary layers, Toast fallback loses its current lifecycle, or a default provider renders differently from no provider | | ||
| | INV14, INV15 | Source boundary check over Core for top-layer hosts, exit copies, backdrop elements, lift, and rectangle-morph code outside the runtime and the lift module | A component building its own copy of a mechanism INV14 lists (top-layer mounting, close-request delivery, hold, exit copy, or backdrop element), or re-implementing the lift or the grow | | ||
| | INV17 | One runtime suite over every kind of layer root: a `useLayer` layer, inline and portaled, and the Dialog, Drawer, Lightbox, MobileNav, BottomSheetPanel, and ToastViewport content roots, each inside a plain `onClick` wrapper and a Core clickable container; nested layers | A click inside a layer root that reaches an ancestor handler, a caller's wrapper included; an outer layer's handler that receives an inner layer's press; or a document listener or light dismiss that no longer receives it | |
There was a problem hiding this comment.
INV17 lets an ancestor's capture-phase handler receive the press (Item's swipe onClickCapture, ChatComposer's onPointerDownCapture), so "reaches an ancestor handler" would fail a correct build. Suggest "reaches an ancestor bubble-phase handler, a caller's wrapper included", matching the change-coupling bullet.
…ick change and its migration; INV17 verification names bubble-phase handlers
|
/approve-spec b1f407e |
There was a problem hiding this comment.
Approval recommended: INV17 and SelectableCard FR2's staged [breaking] change are owner-approved at this head, and the SelectableCard compatibility sections, the INV17 verification row and the description now match the approved rule. Nothing else is needed before merge; the follow-up build should keep the stop React-tree only and keep SelectableCard's caller onClick receiving layer clicks until the next minor, as the records say.
[Automated review]
|
/approve-spec 8dc1e6d |
There was a problem hiding this comment.
Approval recommended: INV17 and SelectableCard FR2's staged [breaking] change are owner-approved at this head, and the records' statements about the shipped layer runtime (the Tooltip/HoverCard-only guard and the three document listeners the React-tree-only seam protects) check out. The latest push only merges main and leaves the records' text unchanged. Nothing else is needed before merge; the follow-up build should keep the stop React-tree only and keep SelectableCard's caller onClick receiving layer clicks until the next minor, as the records say.
[Automated review]
|
/approve-spec c9423be |
There was a problem hiding this comment.
Approval recommended: INV17 and SelectableCard FR2's staged [breaking] change are owner-approved at this head, and the records' statements about the shipped layer runtime (the Tooltip/HoverCard-only guard and the three document listeners the React-tree-only seam protects) check out. The latest push only merges main and leaves the records' text unchanged. The follow-up build should keep the stop React-tree only and keep SelectableCard's caller onClick receiving layer clicks until the next minor, as the records say.
[Automated review]
There was a problem hiding this comment.
Approval recommended: architecture:layer-runtime INV17 and SelectableCard FR2's staged [breaking] change are owner-approved at this head, and the records' statements about the shipped layer runtime (the Tooltip/HoverCard-only guard and the three document listeners the React-tree-only seam protects) check out. The latest push only merges main and leaves the records' text unchanged. The follow-up build should keep the stop React-tree only and keep SelectableCard's caller onClick receiving layer clicks until the next minor, as the records say.
[Automated review]
|
/approve-spec 2097367 |
Maintainer impact
People clicking inside an open layer (a Tooltip, HoverCard, Popover, menu, sheet, dialog, or toast) should never also activate the row, card, field, or app element around the layer's trigger. Today React carries the click out through the portal, and only Tooltip and HoverCard are guarded, and only against the Core containers that check them. This records one rule at the layer runtime: a press that starts inside a layer root stops at that root in the React tree, while document and window listeners and light dismiss still hear it. A new layer gets the rule by using the runtime, so containers stop carrying per-site guards.
Exact decision needed
Who owns the layer boundary for presses that start inside a layer, and what release class closing it carries.
Existing authority searched
architecture:layer-runtimeINV1–INV15 and its open proposal for INV16 (the input hold); no invariant says where a press that starts inside a layer may travel. INV9 governs outside channels only. INV17 is the next free id.spec:AST-038FR7 and FR8 govern which providers cross the layer boundary, not where events travel; INV17 reuses the same content roots for a separate fact.component:TooltipFR11,component:HoverCardFR11, andcomponent:ChatComposerFR8 state the Tooltip/HoverCard-only form of this rule.Decision
The owner chose this on 2026-11-01 (the layer runtime owns the boundary) and ruled it a patch.
useLayerrenderers and the Dialog, Drawer, Lightbox, MobileNav, BottomSheetPanel, and ToastViewport content roots) runs the handlers inside the layer, then stops propagating through the React tree: no bubble-phase handler on an ancestor of the layer's JSX position receives it, including a caller's own element. An ancestor's capture-phase handler runs before the stop and still receives it. A nested layer stops at its own root. The native event is not stopped, so document and window listeners and light dismiss still receive it. Keyboard, focus, input, wheel, and drag events are out of scope.[fix]for every caller no released record covered (the owner's ruling, 2026-11-01). The one released promise,component:SelectableCardFR2's calleronClickfor clicks that do not toggle (including clicks inside an open Tooltip or HoverCard surface), keeps until the next minor, where that part is staged as[breaking](spec:AST-017FR32).stopPropagation()also stops the native event in React 19, which would break ContextMenu's outsidemousedown, Typeahead's pending click, and the layer's keep-openpointerup.Rejected alternatives
Changed records
component:SelectableCardFR2: the staged next-minor layer exception, marked not built; Contract at a glance (Builder impact, Compatibility/readiness), Compatibility and migration, and Current-state impact state the staged[breaking]change and its migration (a handler that needs those presses moves to the layer content).architecture:layer-runtime: INV17 (bubble-phase handlers) (also routed under thelayeringreview trigger); an owning-code sentence for the React-tree-only seam; a change-coupling bullet; a verification row; Current gaps marks INV17 "Implementation gap: not built" with the patch rationale; the record's opening line names INV17 beside INV14 and INV15.component:TooltipFR11 andcomponent:HoverCardFR11: cite INV17 (requirement text and basis).component:ChatComposerFR8: notes that INV17 subsumes its layer clause; the focus-ring and body-click clauses are unchanged.Claim scope and non-goals
Keyboard, focus, input, wheel, and drag propagation; presses on a trigger (outside the layer); outside-press routing (INV9). The per-site guard lines in other records stay until the code lands.
Follow-up: guards removable once INV17 is built
packages/core/src/Layer/layerSurfacePress.ts: theregisterLayerSurface/isLayerSurfaceregistry, replaced by the runtime's record of open roots.packages/core/src/Tooltip/useTooltip.tsx:ref={registerLayerSurface}on the content.packages/core/src/HoverCard/useHoverCard.tsx:ref={registerLayerSurface}on the content.packages/core/src/Item/Item.tsx: theisLayerSurfacewalk in the row click.packages/core/src/Token/Token.tsx: theisLayerSurfacewalk in the container click.packages/core/src/Chat/ChatComposer.tsx: the layer-surface skip in the body click.Kept and re-pointed:
hooks/useClickableContainer.tshasInteractiveAncestoris exported, so its answer for a press inside an open layer stays the same, sourced from the runtime.Evidence and implementation relationship
Spec only; no implementation in this pull request. The native-event constraint was confirmed with a React 19 probe: a full
stopPropagation()in a React handler silenced a document bubble listener, while capture listeners and the browser's light dismiss kept working.Writing rubric results
Scope
Validation
pnpm install --frozen-lockfilepnpm check:knowledge: Knowledge templates and records are aligned.git diff --check