Skip to content

feat(collapsible): a headless disclosure for a trigger the product renders - #12356

Open
kentonquatman wants to merge 8 commits into
mainfrom
fix/collapsible-headless-disclosure
Open

kentonquatman wants to merge 8 commits into
mainfrom
fix/collapsible-headless-disclosure

Conversation

@kentonquatman

@kentonquatman kentonquatman commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User need

A product sometimes needs a disclosure whose trigger is a whole list row: for
example, one step of a long run log, where the label, the detail, a live clock,
and a marker are one button with aria-expanded.

  1. Why it fails today. Collapsible draws its own trigger button and
    chevron, so it cannot host that row. useCollapsible is the headless option,
    but it is only the open-state machine: no ids, no ARIA wiring, no content
    presence. Each product hand-wires aria-controls, and the usual pattern
    ({isOpen && <div id=…>}) leaves aria-controls naming an element that is
    not in the page while closed.
  2. Why it harms the task. These lists hold hundreds of closed rows.
    Collapsible keeps closed children mounted and hides them with
    display: none, so every closed subtree still renders, and on a phone that
    costs real time on every list mount.
  3. Why it matters. A product then ships its own disclosure: its own ids,
    its own presence logic, and its own measured-height grow and fade. Each copy
    drifts from the system's disclosure semantics and from Reduce Motion.

Problem and solution fit

  • Primary — headless disclosure in useCollapsible. The hook returns
    triggerProps and contentProps. Spreading them onto a <button> and an
    always-rendered content element makes one disclosure. Children render only
    while isOpen, so a closed row is one empty element.
  • Primary, opt-in motion — useCollapsibleContentMotion, its own import.
    It takes the useCollapsible result and returns isPresent, isEntering,
    isExiting, and contentProps to spread in place of the hook's. Its phases
    last while the content element's own CSS animation plays, and the children
    stay (inert) until animationend / animationcancel. With no running
    animation the phase ends before the frame paints. Under Reduce Motion the
    shared policy decides: a fine pointer ends the phase at once, and a coarse
    pointer waits for the content's cross-fade. heightProperty measures the
    content's natural height once per open and animated close, with the
    animation suppressed for the read, in one pass for every row a commit
    changes. useCollapsible, Collapsible, and Banner import none of it.
  • Supporting — Collapsible hasLazyMount. The same need for the
    rendered component: an opt-in that mounts children only while open, keeps
    the empty region so aria-controls resolves, keeps children through an
    animatedLayout close, and keeps AR4 focus return.
  • Supporting — one generated id per instance. The hook now owns the
    content id. Collapsible and Banner take theirs from it instead of
    calling useId again, so each still takes one id from the page and every
    later id keeps the value it has today. A direct hook call takes one new id.
  • Supporting — records, docs, examples, tests. Two draft module records,
    proposed rows in component:Collapsible, hook and component docs, the
    existing useCollapsible template block moved to the new props, a new
    useCollapsibleContentMotion template block, two stories, and tests.

Current specification

No current record decides the new API rows, so each row is for an owner
decision (architecture:public-component-api INV25). The proposed claims:

  • module:Collapsible/useCollapsible (new, draft): FR1–FR3, AR1–AR2,
    OQ1–OQ2.
  • module:Collapsible/useCollapsibleContentMotion (new, draft): FR1–FR8,
    ORD1–ORD2, PR1–PR3, AR1–AR2, OQ1–OQ2.
  • component:Collapsible (current): a proposed content mounting concept and
    FR11 (hasLazyMount), basis proposal; the component lists both modules
    and hands the hooks' wiring and motion to them.

Current authority the design follows:

  • spec:AST-055/DEC-4: a hook returns triggerProps to spread; that is the
    hook convention, separate from component render props.
  • architecture:public-component-api INV21 (one API per job: the existing
    headless disclosure hook is extended, not duplicated), INV2/DEC-1
    (useCollapsible is the system's term; the CLI search already maps
    useDisclosure to it), DEC-2 (no new data-* attribute: state reaches
    styles as returned values plus aria-expanded, hidden, and inert).
  • architecture:component-import-boundaries INV7, INV10: the motion code is
    reachable only through its own hook, and a page without it grows by less
    than 0.3 KB gzip (table below).
  • architecture:react-component-runtime INV19: useCollapsible.ts is 180
    lines; useCollapsibleContentMotion.ts is 242 lines and 2,978 B gzip of
    source, under the 300-line and 3 KB threshold. It reuses the shared Reduce
    Motion policy and the shared realm; the Collapsible record says why no shared
    engine plays a caller's CSS keyframes.
  • design:reduced-motion DR1, DR2, DR3: the companion takes its answer from
    the shared reducedMotionFade policy, so a touch row cross-fades and any
    other pointer changes at once.
  • architecture:react-component-runtime INV2, INV3, INV5, INV6 (the routed
    concern): the phase derives during render; the one layout effect names the
    system it syncs (the content element's layout and CSS animations); the
    animation listeners follow node replacement through the callback ref and
    clean up with it.
  • spec:AST-105 stays the owner of Core's own disclosure motion; nothing here
    changes animatedLayout.

Public delta and caller burden

Surface Row Default
UseCollapsibleReturn triggerProps: {type: 'button'; 'aria-expanded'; 'aria-controls'; onClick} —
UseCollapsibleReturn contentProps: {id; hidden} —
@astryxdesign/core/Collapsible export useCollapsibleContentMotion(collapsible, options?) —
UseCollapsibleContentMotionOptions heightProperty?: `--${string}` absent
UseCollapsibleContentMotionReturn isPresent, isEntering, isExiting isOpen, false, false
UseCollapsibleContentMotionReturn contentProps: {id; hidden; inert; ref} —
Collapsible prop hasLazyMount?: boolean false

No behavior change for existing callers of Collapsible and Banner: the new
prop is off by default, existing returns keep their values, and their
generated ids keep their values. A direct useCollapsible call now takes one
id from useId, so ids React generates after it shift by one; the record and
the release note say so. useCollapsible writes nothing to the DOM. No
theming target, token, or data attribute changes.

Before (the pattern the useCollapsible template block showed):

const detailsId = useId();
const disclosure = useCollapsible({isCollapsible: {defaultIsOpen: false}});
<button type="button" aria-expanded={disclosure.isOpen} aria-controls={detailsId} onClick={disclosure.toggle}>Details</button>
{disclosure.isOpen && <div id={detailsId}>…</div>}

After — a whole-row trigger:

const row = useCollapsible({isCollapsible: {defaultIsOpen: false}});
<button {...row.triggerProps}>{label}{detail}{clock}{marker}</button>
<div {...row.contentProps}>{row.isOpen && <RowDetails />}</div>

After — the same row with a measured grow and fade:

const row = useCollapsible({isCollapsible: {defaultIsOpen: false}});
const motion = useCollapsibleContentMotion(row, {heightProperty: '--row-panel-height'});
<button {...row.triggerProps}>{label}{detail}{clock}{marker}</button>
<div
  {...motion.contentProps}
  {...stylex.props(styles.panel, motion.isEntering && styles.opening, motion.isExiting && styles.closing)}>
  {motion.isPresent && <RowDetails />}
</div>
// keyframes: height 0 → var(--row-panel-height), opacity 0 → 1, and the mirror;
// under Reduce Motion, an opacity-only fade for (pointer: coarse) and none otherwise
<Collapsible trigger="Details" hasLazyMount>…</Collapsible>

New caller decisions: whether the content animates (one more hook call),
which custom property gets the height, the trigger's own paint and focus ring,
and keyframes keyed on the phases. To keep an own onClick, compose with
composeEventHandlers(yours, triggerProps.onClick).

First-load size

pnpm size:pages --base 815282dc4 --page collapsible=Collapsible --page banner=Banner --unused-on collapsible,banner,
minified / gzip bytes, for a page that renders the component without
useCollapsibleContentMotion:

Page Base Head Change
docs, form, menu, table (reference pages) — — +0 / +0 each
Collapsible 75,718 / 25,824 75,901 / 25,933 +183 / +109
Banner 192,278 / 64,542 192,415 / 64,598 +137 / +56

Both pages stay within the 0.3 KB (307 B) that an unused optional feature may
add (architecture:component-import-boundaries INV10). The script reports
PASS for both.

Design and alternatives

Decisions for an owner (also open questions in the module records):

  • Motion shape (content-motion OQ1): a companion hook in its own import
    (this PR), vs a plugin value passed to useCollapsible
    (contentMotion: createCollapsibleContentMotion({heightProperty})), vs an
    animatedLayout option that reports the change to the shared glide
    (spec:AST-105 FR1 allows a hook option; it keeps one disclosure motion in
    Core but needs a container handle and plays no grow and fade). The
    companion keeps the motion code off every page that does not call it, and
    keeps useCollapsible small. Either alternative can replace it before the
    API is approved.
  • Headless shape (useCollapsible OQ1): extend useCollapsible (this PR;
    one hook for disclosure state, INV21) vs a separate useDisclosure built on
    it.
  • Names (content-motion OQ2): useCollapsibleContentMotion (alt.
    useDisclosureMotion), heightProperty (alt. contentHeightProperty),
    isPresent (alt. isMounted), isEntering/isExiting (alt. one
    contentMotion: 'entering' | 'exiting' | null), and hasLazyMount
    (useLayer calls the concept lazyMount; the boolean-prop lint requires
    is/has on component props; alt. isLazy). The prop and option types stay
    inline on the return types, as useMenuHover and usePopover do.
  • Reduce Motion for caller-animated rows (content-motion FR7): the shared
    policy's touch cross-fade holds the phase while the caller's fade plays; the
    caller makes that animation an opacity-only fade of 200 ms or less.
  • Public attributes: none added. The rejected alternative is a
    data-state / data-motion attribute, which needs a current record
    (DEC-2).
  • Focus (useCollapsible OQ2): focus inside content that closes stays the
    caller's job; the alternative is a trigger ref in triggerProps so the hook
    moves focus as Collapsible AR4 does.
  • Close ordering: the exit ends with flushSync from the content's own
    animationend, so no frame paints the children after their close animation
    even without animation-fill-mode: forwards.
  • Scope: hasLazyMount can split into its own pull request if the owner
    prefers.

Evidence

  • useCollapsible.test.tsx (20): config parsing, the three modes, props and
    id wiring, closed content empty and hidden, mount and unmount counts,
    controlled mode, and a return that holds only the headless basics.
  • useCollapsibleContentMotion.test.tsx (22): phases on mount / open / close
    / reopen during close, animationend, animationcancel, a descendant's
    animation, endless animations and transitions ignored, a replaced content
    element; Reduce Motion with a fine and a coarse pointer, and the theme's
    reduce-motion mark with each; the height measurement (suppressed read,
    restore of an inline animation-name, no write on mount, no read for a
    close that drops its children or that Reduce Motion completes at once,
    content-box, scaled ancestor), and one measurement pass for two accordion
    rows that change in the same commit.
  • Each new test fails against the code it guards: the earlier private Reduce
    Motion check fails both coarse-pointer tests; measuring each row at once
    fails the one-pass test; measuring every close fails both no-measure tests;
    dropping the phase hold fails 8 phase tests; and the earlier
    useCollapsible fails the headless-basics test.
  • __tests__/useCollapsible.a11y.test.tsx: DISCLOSURE_PATTERN jsdom lane
    for a whole-row trigger (closed, open, closed with content motion).
  • Collapsible.test.tsx: hasLazyMount closed and empty, mount and unmount,
    default unchanged, AR4 focus return with the focused child unmounted; a
    Collapsible takes exactly one generated id, so the ids after it keep their
    values.
  • animatedLayoutAdopters.test.tsx: hasLazyMount keeps children through an
    animatedLayout exit, then unmounts them.
  • Collapsible.a11y.test.tsx: new lazy-closed-end-ltr state (with its
    A11y/Collapsible Disclosure story for the Chromium lane).
  • Stories: Core/Collapsible "Headless rows (useCollapsible)" (200 rows,
    measured grow and fade on theme motion tokens, with the Reduce Motion fade
    for touch) and "Lazy mount". Template block:
    useCollapsibleContentMotion — Animated Details.

Not yet shown: real-browser frames of the grow and fade, and of the close's
last frame. I could not run a real browser locally; this pull request's Storybook
preview and CI carry the visual evidence.

Scope

Components: Collapsible, useCollapsible, useCollapsibleContentMotion

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm build (packages/core): pass.
  • pnpm typecheck (packages/core: source, tests, docs): pass.
    typecheck:template-docs and typecheck:strict (packages/cli): pass.
    typecheck (apps/storybook): pass.
  • pnpm exec vitest run packages/core/src/Collapsible packages/core/src/Banner packages/core/src/motion/animatedLayoutAdopters.test.tsx packages/core/src/motion/reducedMotion.test.ts scripts/shared-identity.test.mjs apps/sandbox/src/route-manifest.test.ts internal/shadcn-registry/generate-shadcn-registry.test.mjs packages/cli/api/template:
    580 passed.
  • pnpm exec vitest run packages/cli/test/experimental-isolation.test.mjs:
    54 passed, with the search close goldens updated: the new hook's doc
    matches "close".
  • pnpm exec vitest run --project ui: 26,034 passed, 6 failed in
    postinstall, DateTimeInput, TimeInput, and timeFormat (locale hour
    cycles and day periods). The same 6 fail on the merge base in the same
    environment.
  • pnpm exec vitest run --project node: 26,276 passed. The failures here are
    in suites that need a browser, a case-sensitive file system, or this
    machine's home folder and CI history (theme editor and theme build, CI
    tooling, packed-gather caches, setup nudges); none of them touches a file
    this change edits, and the CI tooling and packed-gather failures also fail on
    the merge base here. CI runs the node suites on Linux.
  • ASTRYX_STRICT_LINT=1 pnpm exec eslint <changed files>: clean.
  • pnpm check:repo (includes check:knowledge and check:changesets): pass.
  • pnpm size:pages (table above): PASS for both pages.
  • pnpm specs:for --diff origin/main: followed the routed
    architecture:react-component-runtime INV2, INV3, INV5, INV6.
  • pnpm review:pre: 0 findings; items a, b, d, e, f, g apply (a and g wait on
    an owner; e is the new template block).

Writing rubric results

module:Collapsible/useCollapsible (new, draft):

  • R1 narration: none. Intent and every claim state what the hook does in the
    present tense.
  • R2 research in the record: none. Alternatives appear only as unanswered
    options in OQ1–OQ2.
  • R3 evidence naming a change: none. Verification cells name tests and the
    facts they prove.
  • R4 rejected alternatives over one line or outside a decision: none. No
    decision is recorded yet.
  • R5 pull request or issue references remaining: none (searched # plus
    digits, /pull/, /issues/).
  • R6 ruled open questions still listing options: none. OQ1–OQ2 are unanswered
    and keep their options.
  • R7 project status: none.

module:Collapsible/useCollapsibleContentMotion (new, draft):

  • R1 narration: none. Intent and every claim state what the hook does in the
    present tense.
  • R2 research in the record: none. Alternatives appear only as unanswered
    options in OQ1–OQ2.
  • R3 evidence naming a change: none. Verification cells name tests, the size
    script, and the facts they prove.
  • R4 rejected alternatives over one line or outside a decision: none. No
    decision is recorded yet; rejected shapes stay in this description.
  • R5 pull request or issue references remaining: none (searched # plus
    digits, /pull/, /issues/).
  • R6 ruled open questions still listing options: none. OQ1–OQ2 are unanswered
    and keep their options.
  • R7 project status: the verification map states the missing real-browser
    frames as an evidence gap, a template field.

component:Collapsible (current, amended):

  • R1 narration: none. The added compatibility line, ownership lines, concept
    row, FR11, relationship lines, and verification row describe the component.
  • R2 research in the record: none. The INV19 line states why no shared engine
    fits, in the present tense.
  • R3 evidence naming a change: none. The FR11 row cites tests.
  • R4 rejected alternatives over one line or outside a decision: none added.
  • R5 pull request or issue references remaining: none added.
  • R6 ruled open questions still listing options: none added.
  • R7 project status: none. proposal (basis) and proposed (stability) mark
    rows an owner has not approved.

…nders

useCollapsible returns triggerProps and contentProps, so a product can make
a whole list row the disclosure button and keep its content element empty
while closed. The optional hasContentAnimation keeps the children, inert,
through the content's own close animation, and contentHeightProperty
receives the content's measured height for grow and shrink keyframes.
Collapsible gains an opt-in hasLazyMount that mounts its children only while
open. Defaults are unchanged.
@vercel

vercel Bot commented Nov 17, 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 18, 2026 4:58am UTC

Request Review

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

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 18, 2026, 5:17 AM UTC

@github-actions github-actions Bot added needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:spec-owner-review Current knowledge records await owner approval labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · e47e539

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Collapsible 29.1 kB (+100 B) · 4.5 kB CSS (0) — ✓ · ✓ · ✓
lab/Comments 372.4 kB (+73 B) · 2.5 kB CSS (0) — — · — · —
Banner · Storybook 68.0 kB (+68 B) · 11.3 kB CSS (0) 513 (+1) ✓ · ✓ · —
3 more components
Component Size LoC Visual · A11y · RTL
lab/CommentComposer 175.1 kB (+66 B) · 1.9 kB CSS (0) — — · — · —
lab/CommentThread 365.5 kB (+58 B) · 2.4 kB CSS (0) — — · — · —
CollapsibleGroup 7.0 kB (0) · 3.3 kB CSS (0) — ✓ · ✓ · ✓

Package size:

  • @astryxdesign/cli 5.33 MB packed (+783 B); no new dependencies
  • @astryxdesign/core 7.64 MB packed (+7.5 kB); no new dependencies

API changes: core +9 · ~0 · −0

9 API changes (advisory)
Package Where Signature Usage
+ core . · Components · component Collapsible prop hasLazyMount?: boolean = false <Collapsible hasLazyMount />
+ core . · Hooks · hook useCollapsibleContentMotion hook useCollapsibleContentMotion: (collapsible: Pick<UseCollapsibleReturn, 'isOpen' | 'contentProps'>, options?: UseCollapsibleContentMotionOptions) => UseCollapsibleContentMotionReturn import {useCollapsibleContentMotion} from '@astryxdesign/core'; useCollapsibleContentMotion(…)
+ core . · Types · interface UseCollapsibleContentMotionOptions interface UseCollapsibleContentMotionOptions import type {UseCollapsibleContentMotionOptions} from '@astryxdesign/core'
+ core . · Types · interface UseCollapsibleContentMotionReturn interface UseCollapsibleContentMotionReturn import type {UseCollapsibleContentMotionReturn} from '@astryxdesign/core'
+ core . · Types · interface UseCollapsibleReturn contentProps: { id: string; hidden: boolean } import type {UseCollapsibleReturn} from '@astryxdesign/core'; const x: UseCollapsibleReturn = {contentProps: …}
+ core . · Types · interface UseCollapsibleReturn triggerProps: { type: 'button'; 'aria-expanded': boolean; 'aria-controls': string; onClick: () => void } import type {UseCollapsibleReturn} from '@astryxdesign/core'; const x: UseCollapsibleReturn = {triggerProps: …}
+ core ./Collapsible · Also exported from an earlier entry point · UseCollapsibleContentMotionOptions UseCollapsibleContentMotionOptions (.) import {UseCollapsibleContentMotionOptions} from '@astryxdesign/core/Collapsible'
+ core ./Collapsible · Also exported from an earlier entry point · UseCollapsibleContentMotionReturn UseCollapsibleContentMotionReturn (.) import {UseCollapsibleContentMotionReturn} from '@astryxdesign/core/Collapsible'
+ core ./Collapsible · Also exported from an earlier entry point · useCollapsibleContentMotion useCollapsibleContentMotion (.) import {useCollapsibleContentMotion} from '@astryxdesign/core/Collapsible'

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


Generated by PR Enrichment workflow | View full report

…he hook

useCollapsible generates the content id now. Collapsible and Banner reuse
it instead of calling useId again, so each still takes one generated id
from the page and every later id keeps the value it had.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: six fixes are needed, and the new API also waits on an engineering owner's decision.

Blocking

  • The content-animation and height code ships with useCollapsible, which Collapsible and Banner always import, so a page that renders Collapsible without the new options grows by 771 B gzip (634 B of it the unused optional code) against the 0.3 KB an unused optional feature may add; move it behind its own import or a deferred load, and report the per-page delta.
  • Miss: reducesMotion in useCollapsible.ts re-implements the shared Reduce Motion policy in motion/reducedMotion.ts and drops its coarse-pointer cross-fade, so a touch row snaps under Reduce Motion; take the answer from reducedMotionFade(node) instead.
  • Rows that change in one commit, such as a CollapsibleGroup accordion, each write animation-name, read the height and write again in turn, forcing an extra layout per row; read every changing row's height before any write.
  • useCollapsible.ts is now 379 lines and about 4.5 KB gzip of behavior code that reuses no shared engine; build the phases on animatedLayout, as Collapsible's own exit already does, or record in the Collapsible record why none fits.
  • With hasContentAnimation, a close that drops the children at once (no running animation, or Reduce Motion) still measures and writes the height, while the description, JSDoc, docs and draft FR9 say only animated closes do; check the hold before measuring a close and test that case.
  • The description says existing callers keep their generated ids, but every direct useCollapsible call now takes one id from the page; narrow it to Collapsible and Banner.

Owner decision: no current record decides the eight new API rows, the draft useCollapsible module record or Collapsible's proposed FR11, including how the touch cross-fade rule applies to caller-animated rows. An engineering owner records approval by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner. The earlier blocker about duplicated disclosure wiring is fixed.

Claims and files checked

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

Claims:

  • CLI changeset, the template block wires its trigger and content with the hook's props so the trigger always names an element: verified (CollapsibleHookUsage.tsx:23-38).
  • Core changeset, the hook returns trigger and content props and closed content mounts nothing: verified when children are gated on isPresent (all 200 closed story rows empty in Chromium).
  • Core changeset, hasContentAnimation keeps children through the content's close animation: verified (content animation tests; Chromium close probe).
  • Core changeset, contentHeightProperty receives the measured height: verified (content height tests; 76 px in Chromium).
  • Core changeset, hasLazyMount mounts children only while open: verified (lazy suite; 2 of 20 mounted in the Lazy mount story).
  • Collapsible keeps closed children mounted and hidden today: verified (lazy suite default case).
  • The old pattern leaves aria-controls naming a missing element while closed: verified (base template block).
  • Phases last while the content's own animation plays, with the children inert until it ends or is cancelled: verified (tests; Chromium).
  • With no running animation or under Reduce Motion the phase ends before the frame paints: verified (tests; Chromium touch probe).
  • The height is measured once per open and animated close: false (also at closes that drop the children at once).
  • hasLazyMount keeps the empty region, keeps children through an animated-layout close and keeps focus return: verified (lazy suite; animated-layout lazy exit test).
  • Collapsible and Banner each take one generated id from the page: verified (Collapsible.test.tsx generated ids).
  • Existing callers keep their generated ids: false for direct hook callers (useCollapsible.ts:283).
  • No theming target, token or data attribute changes: verified (generated API delta: 8 core rows, 0 theme rows).
  • Without the options the hook writes nothing to the DOM: verified.
  • The named test suites and typechecks pass: verified for the Collapsible, Banner, animated-layout and doc suites (715 tests), the core typecheck and the template-docs typecheck.
  • Real-browser frames of the grow and fade were not shown: this review captured the open and close in Chromium.

Files:

  • .changeset/the-usecollapsible-template-block-wires-its-trig-v9i6.md: clear.
  • .changeset/usecollapsible-returns-triggerprops-and-contentp-10sw.md: clear.
  • apps/storybook/stories/Collapsible.stories.tsx: clear.
  • apps/storybook/stories/CollapsibleA11y.stories.tsx: clear.
  • docs/specs/components/Collapsible/Collapsible.spec.md: owner decision (FR11, concept row, ownership lines).
  • docs/specs/components/Collapsible/modules/useCollapsible.spec.md: owner decision; FR9 claim false; temporary status line 41 (non-blocking).
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleHookUsage.tsx: clear.
  • packages/core/src/Banner/Banner.tsx: clear.
  • packages/core/src/Collapsible/Collapsible.doc.mjs: clear.
  • packages/core/src/Collapsible/Collapsible.test.tsx: clear.
  • packages/core/src/Collapsible/Collapsible.tsx: clear.
  • packages/core/src/Collapsible/__tests__/Collapsible.a11y.states.ts: clear.
  • packages/core/src/Collapsible/__tests__/useCollapsible.a11y.test.tsx: clear.
  • packages/core/src/Collapsible/useCollapsible.doc.mjs: height claim false.
  • packages/core/src/Collapsible/useCollapsible.test.tsx: clear; the height suite misses the animated-option close case.
  • packages/core/src/Collapsible/useCollapsible.ts: first-load cost, duplicated Reduce Motion check, interleaved reads, engine rule, measurement order, ids claim.
  • packages/core/src/motion/animatedLayoutAdopters.test.tsx: clear.

Automated review (maintainer link)

… that drops its children

Content elements that change in one commit are measured together: every
animation is suppressed, then every height is read, then every value is
written, so accordion rows that open and close together force one layout.
A close is measured only when its own animation holds the children. The
record and the release note say that a direct useCollapsible call takes one
generated id.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: three fixes are needed, and the new API also waits on an engineering owner's decision.

Blocking

  • The content-animation and height code ships with useCollapsible, which Collapsible and Banner always import, so a page that renders Collapsible without the new options carries 741 B gzip of unused optional code (871 B in all, by the description's own table) against the 0.3 KB an unused optional feature may add; move it behind its own import or a deferred load.
  • Miss: reducesMotion in useCollapsible.ts still re-implements the shared Reduce Motion policy in motion/reducedMotion.ts and drops its coarse-pointer cross-fade, so a touch row snaps open and shut under Reduce Motion; take the answer from reducedMotionFade(node) instead.
  • useCollapsible.ts is now 412 lines and about 5 KB gzip of behavior code that reuses no shared engine; build the phases on animatedLayout, as Collapsible's own exit already does, or record in the Collapsible record why none fits.

Owner decision: no current record decides the eight new API rows, the draft useCollapsible module record or Collapsible's proposed FR11, including how the touch cross-fade rule applies to caller-animated rows. An engineering owner records approval by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner. The batched height pass, the skipped measurement for closes that drop their children, the narrowed id claim and the record's status line fix the earlier findings.

Claims and files checked

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

Claims:

  • CLI changeset, the template block wires its trigger and content with the hook's props so the trigger names an element that stays in the page: verified (CollapsibleHookUsage.tsx:23-38).
  • Core changeset, the hook returns trigger and content props and closed content mounts nothing: verified when children are gated on isPresent (props tests; all 200 closed story rows empty in Chromium).
  • Core changeset, hasContentAnimation keeps the children through the content's close animation: verified (content animation tests; Chromium close probe).
  • Core changeset, contentHeightProperty receives the measured height: verified (content height tests; 76 px in Chromium).
  • Core changeset, hasLazyMount mounts children only while open: verified (lazy suite; 2 of 20 mounted in the Lazy mount story).
  • Core changeset, a direct hook call takes one generated id while Collapsible and Banner keep theirs: verified (useCollapsible.ts:313, Collapsible.tsx:514, Banner.tsx:579; generated-ids test; the same ids base and head in Chromium).
  • Collapsible draws its own trigger and the base hook had no ids, ARIA wiring or presence: verified (base hook).
  • The usual pattern leaves aria-controls naming a missing element while closed: verified (base template block).
  • Collapsible keeps closed children mounted and hidden today: verified (lazy suite default case).
  • Phases last while the content's own animation plays, with the children inert until it ends or is cancelled: verified (tests; Chromium).
  • With no running animation or under Reduce Motion the phase ends before the frame paints: verified (tests; Chromium touch probe).
  • The height is measured once per open and animated close, with the animation suppressed for the read: verified (content height tests, including the two new close cases).
  • Rows that change in one commit are measured in one pass: verified (accordion test).
  • hasLazyMount keeps the empty region, keeps children through an animated-layout close and keeps focus return: verified (lazy suite; animated-layout lazy exit test).
  • Existing Collapsible and Banner callers see no behavior change and keep their generated ids: verified (default frames pixel-identical; ids test).
  • Without the options the hook writes nothing to the DOM: verified (useCollapsible.ts:333-390).
  • No theming target, token or data attribute changes: verified (generated API delta: 8 core rows, 0 theme rows).
  • First-load size table: verified for the head column (both component pages reproduced exactly; reference pages +0).
  • The hook file is over the 300-line engine threshold: verified (412 lines).
  • The close ends with flushSync from the content's own animationend: verified (useCollapsible.ts:351).
  • Build, Core typecheck, strict lint of the changed files and the targeted suites pass: verified (718 tests at this head; the stated 714 predates the latest commit's tests).
  • Full UI project, CLI tests, repository checks and changeset coverage pass: not rerun.
  • Real-browser frames of the grow and fade were not shown: Chromium probes of the open and close were taken for this review.

Files:

  • .changeset/the-usecollapsible-template-block-wires-its-trig-v9i6.md: clear.
  • .changeset/usecollapsible-returns-triggerprops-and-contentp-10sw.md: clear.
  • apps/storybook/stories/Collapsible.stories.tsx: clear.
  • apps/storybook/stories/CollapsibleA11y.stories.tsx: clear.
  • docs/specs/components/Collapsible/Collapsible.spec.md: owner decision (FR11, concept row, ownership lines).
  • docs/specs/components/Collapsible/modules/useCollapsible.spec.md: owner decision (draft FR1-FR9, PR1-PR2, FR8 against the touch cross-fade rule).
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleHookUsage.tsx: clear.
  • packages/core/src/Banner/Banner.tsx: clear.
  • packages/core/src/Collapsible/Collapsible.doc.mjs: clear.
  • packages/core/src/Collapsible/Collapsible.test.tsx: clear.
  • packages/core/src/Collapsible/Collapsible.tsx: clear.
  • packages/core/src/Collapsible/__tests__/Collapsible.a11y.states.ts: clear.
  • packages/core/src/Collapsible/__tests__/useCollapsible.a11y.test.tsx: clear.
  • packages/core/src/Collapsible/useCollapsible.doc.mjs: clear.
  • packages/core/src/Collapsible/useCollapsible.test.tsx: clear.
  • packages/core/src/Collapsible/useCollapsible.ts: first-load cost, duplicated Reduce Motion check, engine rule.
  • packages/core/src/motion/animatedLayoutAdopters.test.tsx: clear.

Automated review (maintainer link)

…Core

The map of content elements that wait for a height measurement lives under
a registered shared key, so two copies of Core on one page share one pass.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: three fixes are needed, and the new API also waits on an engineering owner's decision.

Blocking

  • The content-animation and height code ships with useCollapsible, which Collapsible and Banner always import, so a page that renders Collapsible without the new options carries 758 B gzip of unused optional code (890 B in all against the merge base, more than the description's table, which predates the latest commit) against the 0.3 KB an unused optional feature may add; move it behind its own import or a deferred load and update the table.
  • Miss: reducesMotion in useCollapsible.ts still re-implements the shared Reduce Motion policy in motion/reducedMotion.ts and drops its coarse-pointer cross-fade, so a touch row snaps open and shut under Reduce Motion; take the answer from reducedMotionFade(node) instead.
  • useCollapsible.ts is now 419 lines and about 5 KB gzip of behavior code that reuses no shared engine; build the phases on animatedLayout, as Collapsible's own exit already does, or record in the Collapsible record why none fits.

Owner decision: no current record decides the eight new API rows, the draft useCollapsible module record or Collapsible's proposed FR11, including how the touch cross-fade rule applies to caller-animated rows. An engineering owner records approval by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner. The shared height queue in the latest commit is fine as written.

Claims and files checked

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

Claims:

  • CLI changeset, the template block wires its trigger and content with the hook's props so the trigger names an element that stays in the page: verified (CollapsibleHookUsage.tsx:24-35).
  • Core changeset, the hook returns trigger and content props and closed content mounts nothing: verified when children are gated on isPresent (props tests; all 200 closed story rows empty in Chromium).
  • Core changeset, hasContentAnimation keeps the children through the content's close animation: verified (content animation tests; Chromium close probe).
  • Core changeset, contentHeightProperty receives the measured height: verified (content height tests; 76 px in Chromium).
  • Core changeset, hasLazyMount mounts children only while open: verified (lazy suite; 2 of 20 mounted in the Lazy mount story).
  • Core changeset, a direct hook call takes one generated id while Collapsible and Banner keep theirs: verified (useCollapsible.ts:320, Collapsible.tsx:514, Banner.tsx:579; generated-ids test; the same ids base and head in Chromium).
  • Collapsible draws its own trigger and the base hook had no ids, ARIA wiring or presence: verified (base hook).
  • The usual pattern leaves aria-controls naming a missing element while closed: verified (base template block).
  • Collapsible keeps closed children mounted and hidden today: verified (lazy suite default case).
  • Phases last while the content's own animation plays, with the children inert until it ends or is cancelled: verified (tests; Chromium).
  • With no running animation or under Reduce Motion the phase ends before the frame paints: verified (tests; Chromium touch probe).
  • The height is measured once per open and animated close, with the animation suppressed for the read: verified (content height tests).
  • Rows that change in one commit are measured in one pass, shared by every copy of Core: verified (accordion test; useCollapsible.ts:205-232).
  • hasLazyMount keeps the empty region, keeps children through an animated-layout close and keeps focus return: verified (lazy suite; animated-layout lazy exit test).
  • Existing Collapsible and Banner callers see no behavior change and keep their generated ids: verified (default frames pixel-identical; ids test).
  • Without the options the hook writes nothing to the DOM: verified (useCollapsible.ts:340-397).
  • No theming target, token or data attribute changes: verified (generated API delta: 8 core rows, 0 theme rows).
  • First-load size table: false at this head; the base column is reproduced exactly, but the head now measures 78,101 / 26,714 and 194,657 / 65,393 bytes (+890 B and +851 B gzip), with the reference pages +0.
  • The hook file is over the 300-line engine threshold: verified (419 lines).
  • The close ends with flushSync from the content's own animationend: verified (useCollapsible.ts:358).
  • Build, Core typecheck, the CLI template typecheck, strict lint of the changed files and the targeted suites pass: verified (724 tests including the shared-state suite; the stated 714 predates later tests).
  • Full UI project, CLI tests, repository checks and changeset coverage pass: not rerun.
  • Real-browser frames of the grow and fade were not shown: Chromium probes of the open and the close stand in for them.

Files:

  • .changeset/the-usecollapsible-template-block-wires-its-trig-v9i6.md: clear.
  • .changeset/usecollapsible-returns-triggerprops-and-contentp-10sw.md: clear.
  • apps/storybook/stories/Collapsible.stories.tsx: clear.
  • apps/storybook/stories/CollapsibleA11y.stories.tsx: clear.
  • docs/specs/components/Collapsible/Collapsible.spec.md: owner decision (FR11, concept row, ownership lines).
  • docs/specs/components/Collapsible/modules/useCollapsible.spec.md: owner decision (draft FR1-FR9, PR1-PR2, FR8 against the touch cross-fade rule).
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleHookUsage.tsx: clear.
  • packages/core/src/Banner/Banner.tsx: clear.
  • packages/core/src/Collapsible/Collapsible.doc.mjs: clear.
  • packages/core/src/Collapsible/Collapsible.test.tsx: clear.
  • packages/core/src/Collapsible/Collapsible.tsx: clear.
  • packages/core/src/Collapsible/__tests__/Collapsible.a11y.states.ts: clear.
  • packages/core/src/Collapsible/__tests__/useCollapsible.a11y.test.tsx: clear.
  • packages/core/src/Collapsible/useCollapsible.doc.mjs: clear.
  • packages/core/src/Collapsible/useCollapsible.test.tsx: clear.
  • packages/core/src/Collapsible/useCollapsible.ts: first-load cost, duplicated Reduce Motion check, engine rule.
  • packages/core/src/motion/animatedLayoutAdopters.test.tsx: clear.

Automated review (maintainer link)

useCollapsible keeps the headless basics: triggerProps, contentProps (id and
hidden), and content that mounts nothing while closed. The motion phases,
presence through the close, and the measured height property move to
useCollapsibleContentMotion, a separate import that useCollapsible,
Collapsible, and Banner never load. Against the merge base, a Collapsible
page now grows 109 B gzip and a Banner page 56 B.

Under Reduce Motion the new hook follows the shared policy: a fine pointer
opens and closes at once, and a coarse pointer waits for the content's
cross-fade. A new template block shows the hook, and two draft module records
describe the two hooks.
@kentonquatman

Copy link
Copy Markdown
Contributor Author

The three blocking findings from the review on 9704243, and their fixes in aa0f95b:

  1. Unused optional code (architecture:component-import-boundaries INV10). The motion code moved out of useCollapsible into useCollapsibleContentMotion, its own module and import. useCollapsible, Collapsible, and Banner import none of it. Without it, a Collapsible page grows +109 B gzip and a Banner page +56 B against the merge base (limit 307 B; pnpm size:pages reports PASS for both). The table is in the description.
  2. Reduce Motion policy. useCollapsibleContentMotion takes the answer from reducedMotionFade(node): a phase ends at once only when it returns duration 0, and a coarse pointer waits for the content's cross-fade.
  3. Behavior module size (architecture:react-component-runtime INV19). useCollapsible.ts is 180 lines. useCollapsibleContentMotion.ts is 244 lines and 2,984 B gzip, under the 300-line and 3 KB threshold. It reuses the shared Reduce Motion policy and the shared realm, and the Collapsible record states why no shared engine plays a caller's CSS keyframes.

The owner decision on the API rows and the two draft module records stays open.

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

Waiting on an engineering owner's API decision; no blocking code issue remains at this head, and the three fixes from the last review are in.

Owner decision needed: no current record decides the new public API (useCollapsible's triggerProps and contentProps, the new useCollapsibleContentMotion hook with its options and return, and Collapsible's hasLazyMount), the two draft module records, Collapsible's proposed FR11, or the extra generated id that a direct useCollapsible call now takes. The same decision can settle how the motion record's Reduce Motion rule (FR7) treats a theme that reduces motion for everyone, since caller CSS can only see the prefers-reduced-motion query. An engineering owner records it by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Non-blocking:

  • The useCollapsibleContentMotion doc lists heightProperty as a second parameter; name it options.heightProperty, as the useAnimatedLayout and useCalendarConstraints docs do, so the CLI shows the real signature.
  • measureNaturalHeight only queues the element and flushNaturalHeights measures it; queueNaturalHeight would say what it does.
Claims and files checked

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

Claims:

  • CLI release note, the hook's template block spreads the trigger and content props so the trigger names an element that stays while closed: verified (CollapsibleHookUsage.tsx:23-38).
  • CLI release note, a new animated-details block grows and fades to the measured height and shrinks and fades out: verified (CollapsibleContentMotionUsage.tsx:20-29, :77-108).
  • Core release note, the hook returns trigger and content props and closed content mounts nothing: verified when children are gated on isOpen (props tests; 200 closed story rows empty in Chromium).
  • Core release note, the motion hook is a separate import that keeps the children through the close animation and writes the measured height: verified (motion tests; Chromium close probe; 76 px).
  • Core release note, under Reduce Motion a touch screen cross-fades and other pointers change at once: verified for the system setting (Reduce Motion tests; Chromium on a Pixel 7 profile and a desktop pointer).
  • Core release note, hasLazyMount mounts children only while open: verified (lazy suite; 2 of 20 mounted in the story).
  • Core release note, a direct hook call takes one generated id while Collapsible and Banner keep theirs: verified (useCollapsible.ts:163, Collapsible.tsx:514, Banner.tsx:579; one-id test).
  • Collapsible draws its own trigger, and the base hook had no ids, wiring or presence: verified (base hook).
  • The usual pattern leaves aria-controls naming a missing element while closed: verified (base template block).
  • Collapsible keeps closed children mounted and hidden today: verified (lazy suite default case).
  • Phases last while the content's own animation plays, the children stay inert until it ends or is cancelled, and with no running animation the phase ends before paint: verified (motion tests; Chromium).
  • Reduce Motion takes its answer from the shared policy: verified (useCollapsibleContentMotion.ts:77-79; four Reduce Motion tests).
  • The height is read once per open and animated close, with the animation suppressed, in one pass per commit: verified (height tests, including the two-row accordion case).
  • useCollapsible, Collapsible and Banner import none of the motion code: verified (their imports at this head).
  • First-load size table, +109 B and +56 B gzip with the reference pages unchanged: verified, reproduced exactly.
  • useCollapsible.ts is 180 lines and the motion module 244 lines and 2,984 B gzip: verified.
  • hasLazyMount keeps the empty region, keeps children through an animated close and keeps focus return: verified (lazy suite; animated-layout lazy exit test).
  • No behavior change for existing Collapsible and Banner callers, whose ids keep their values: verified (default case and one-id test; both files unchanged since their last pixel-identical frames).
  • The hook writes nothing to the DOM, and no theming target, token or data attribute changes: verified (hook source; the generated API delta has core rows only).
  • The close ends with flushSync from the content's own animationend: verified (useCollapsibleContentMotion.ts:194).
  • Test counts of 20 and 22 in the two hook suites: verified.
  • Each new test fails against the code it guards: not rerun.
  • Build, typechecks, targeted suites, lint and the size script pass: verified for the Core and CLI template typechecks, 589 targeted tests, strict lint of the changed files and the size script; the full UI and node projects were not rerun.
  • Real-browser frames of the grow and fade are not shown: Chromium probes at this head show the hold and the release.

Files:

  • .changeset/the-usecollapsible-template-block-wires-its-trig-v9i6.md: clear.
  • .changeset/usecollapsible-returns-triggerprops-and-contentp-10sw.md: clear.
  • apps/sandbox/scripts/next-export-routes.json: clear (generated).
  • apps/storybook/stories/Collapsible.stories.tsx: clear.
  • apps/storybook/stories/CollapsibleA11y.stories.tsx: clear.
  • docs/specs/components/Collapsible/Collapsible.spec.md: owner decision (FR11, concept row, ownership lines).
  • docs/specs/components/Collapsible/modules/useCollapsible.spec.md: owner decision (draft requirements and open questions).
  • docs/specs/components/Collapsible/modules/useCollapsibleContentMotion.spec.md: owner decision (draft requirements, FR7's theme case).
  • internal/shadcn-registry/routes.lock.json: clear (generated).
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleContentMotionUsage.doc.mjs: clear.
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleContentMotionUsage.tsx: clear.
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleHookUsage.tsx: clear.
  • packages/cli/test/__golden__/no-icon-set/search-close.json: clear (golden).
  • packages/cli/test/__golden__/no-icon-set/search-close.txt: clear (golden).
  • packages/core/src/Banner/Banner.tsx: clear.
  • packages/core/src/Collapsible/Collapsible.doc.mjs: clear.
  • packages/core/src/Collapsible/Collapsible.test.tsx: clear.
  • packages/core/src/Collapsible/Collapsible.tsx: clear.
  • packages/core/src/Collapsible/__tests__/Collapsible.a11y.states.ts: clear.
  • packages/core/src/Collapsible/__tests__/useCollapsible.a11y.test.tsx: clear.
  • packages/core/src/Collapsible/index.ts: clear.
  • packages/core/src/Collapsible/useCollapsible.doc.mjs: clear.
  • packages/core/src/Collapsible/useCollapsible.test.tsx: clear.
  • packages/core/src/Collapsible/useCollapsible.ts: clear.
  • packages/core/src/Collapsible/useCollapsibleContentMotion.doc.mjs: non-blocking (parameter name).
  • packages/core/src/Collapsible/useCollapsibleContentMotion.test.tsx: clear.
  • packages/core/src/Collapsible/useCollapsibleContentMotion.ts: non-blocking (helper name).
  • packages/core/src/motion/animatedLayoutAdopters.test.tsx: clear.

Automated review (maintainer link)


/** Whether the running animation holds the phase, under the Reduce Motion policy. */
function holdsMotion(node: HTMLElement): boolean {
return reducedMotionFade(node)?.duration !== 0 && isAnimating(node);

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.

Non-blocking, for the owner deciding FR7: reducedMotionFade also counts a theme that reduces motion for everyone, but caller CSS can key only on prefers-reduced-motion, as the template block and story do. Once a theme can resolve reducedMotion: 'always', a touch row in it would hold its phase for the full grow and shrink. Ending the phase at once when only the theme reduces motion would keep the two in step.

…function

The useCollapsibleContentMotion doc lists `options` and
`options.heightProperty`, so the CLI shows the real signature. The function
that only queues an element for the height pass is `queueNaturalHeight`, and
the pass's comment sits on the flush that runs it.

@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's API decision; no blocking code issue remains at this head.

Next step

  • An engineering owner decides the nine new @astryxdesign/core API rows (useCollapsible's triggerProps and contentProps, the new useCollapsibleContentMotion hook with its two types, and Collapsible's hasLazyMount), the two draft module records and the proposed component:Collapsible FR11, including whether heightProperty should follow the existing customProperty option name and how draft FR7 treats a theme that reduces motion for everyone. An engineering owner records approval by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Non-blocking

  • The description says useCollapsibleContentMotion.ts is 244 lines; it is 242 lines at this head, still under the INV19 threshold.
  • The earlier note on draft FR7's theme case (line 78) still applies; the two other notes from the last review are fixed.
Claims and files checked

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

Claims

  • Changeset (CLI): the hook template block wires its trigger and content with the new props, so the trigger names an element that stays while closed — verified (CollapsibleHookUsage.tsx).
  • Changeset (CLI): a new animated-details block grows and fades in to the measured height and shrinks and fades out — verified (CollapsibleContentMotionUsage.tsx).
  • Changeset (core): useCollapsible returns triggerProps and contentProps, and closed content mounts nothing — verified for the documented pattern, children gated on isOpen (useCollapsible.ts:163-179, tests).
  • Changeset (core): useCollapsibleContentMotion is a separate import that keeps children through the close animation and writes the measured height — verified (module imports, tests, size check).
  • Changeset (core): under Reduce Motion a touch screen cross-fades and other pointers open and close at once — verified with the documented caller fade (tests; Chromium touch and desktop probes).
  • Changeset (core): Collapsible hasLazyMount mounts children only while open — verified (Collapsible.tsx:515, lazy suite).
  • Changeset (core): a direct hook call takes one generated id, and Collapsible and Banner keep theirs — verified (one-id test; default stories pixel-identical with the same ids).
  • Description: a whole row can be the trigger and a closed row is one empty element — verified (200 closed rows, 200 empty hidden content elements in Chromium).
  • Description: phases last while the content's own CSS animation plays, and end before paint when none runs — verified (presence and phase tests).
  • Description: the height is measured once per open and animated close, with the animation suppressed, in one pass per commit — verified (height tests; measuring each row at once fails the one-pass test).
  • Description: useCollapsible, Collapsible and Banner import none of the motion code — verified (imports).
  • Description: hasLazyMount keeps the empty region, keeps children through an animated close, and keeps focus return — verified (lazy, animated-layout and focus tests).
  • Description: first-load size grows +109 B (Collapsible) and +56 B (Banner) gzip, reference pages +0 — verified in substance (same minified deltas; +95 B and +51 B on the current base).
  • Description: useCollapsible.ts is 180 lines — verified; the motion module is 244 lines and 2,984 B gzip — false for the line count (242 lines), gzip verified.
  • Description: no behavior change for existing Collapsible and Banner callers, and no data attribute, token or theming target changes — verified (frames, generated API delta).
  • Description: test counts 20 and 22, and each new test fails against the code it guards — counts verified; two of the guards re-checked by mutation.
  • Description: build, typecheck, targeted test suites and strict lint pass — verified for the build, typecheck, targeted suites and lint re-run here.
  • Description: real-browser frames of the grow and fade are not yet shown — accurate; Chromium probes here show the phases.

Files (28 of 28)

  • .changeset/the-usecollapsible-template-block-wires-its-trig-v9i6.md: clear
  • .changeset/usecollapsible-returns-triggerprops-and-contentp-10sw.md: clear
  • apps/sandbox/scripts/next-export-routes.json: clear (generated route entry)
  • apps/storybook/stories/Collapsible.stories.tsx: clear
  • apps/storybook/stories/CollapsibleA11y.stories.tsx: clear
  • docs/specs/components/Collapsible/Collapsible.spec.md: proposed FR11 and module rows wait on an owner decision
  • docs/specs/components/Collapsible/modules/useCollapsible.spec.md: draft record waits on an owner decision
  • docs/specs/components/Collapsible/modules/useCollapsibleContentMotion.spec.md: draft record waits on an owner decision; FR7 theme reading open
  • internal/shadcn-registry/routes.lock.json: clear (generated route entries)
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleContentMotionUsage.doc.mjs: clear
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleContentMotionUsage.tsx: clear
  • packages/cli/assets/templates/blocks/components/Collapsible/CollapsibleHookUsage.tsx: clear
  • packages/cli/test/__golden__/no-icon-set/search-close.json: clear (golden)
  • packages/cli/test/__golden__/no-icon-set/search-close.txt: clear (golden)
  • packages/core/src/Banner/Banner.tsx: clear
  • packages/core/src/Collapsible/Collapsible.doc.mjs: clear
  • packages/core/src/Collapsible/Collapsible.test.tsx: clear
  • packages/core/src/Collapsible/Collapsible.tsx: new prop waits on an owner decision; code clear
  • packages/core/src/Collapsible/__tests__/Collapsible.a11y.states.ts: clear
  • packages/core/src/Collapsible/__tests__/useCollapsible.a11y.test.tsx: clear
  • packages/core/src/Collapsible/index.ts: new exports wait on an owner decision
  • packages/core/src/Collapsible/useCollapsible.doc.mjs: clear
  • packages/core/src/Collapsible/useCollapsible.test.tsx: clear
  • packages/core/src/Collapsible/useCollapsible.ts: new returns wait on an owner decision; code clear
  • packages/core/src/Collapsible/useCollapsibleContentMotion.doc.mjs: clear
  • packages/core/src/Collapsible/useCollapsibleContentMotion.test.tsx: clear
  • packages/core/src/Collapsible/useCollapsibleContentMotion.ts: new hook waits on an owner decision; FR7 theme case at line 78 (non-blocking)
  • packages/core/src/motion/animatedLayoutAdopters.test.tsx: clear

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — e47e539f Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant