Repository navigation
feat(Collapsible): let the chevron lead the trigger - #5993
Conversation
Collapsible has always drawn its chevron as a trailing indicator. The leading disclosure arrow — the tree and file-browser convention, where the labels form a column the arrows sit in front of — was only available from TreeList and the Table row-expansion column, so a card or accordion header had no way to match them. `chevronPlacement` adds that side. The default is unchanged. The side picks the glyph as well as the order. A trailing chevron points down and flips up; a leading one points into the row and turns down, so `start` swaps chevronDown for chevronRight and rotates a quarter turn rather than a half, mirrored in RTL the way TreeList already does it. CollapsibleGroup carries it through the presentation context that already holds hasDividers and density, because a list whose arrows change sides row to row reads as a bug. An item still overrides its group, and a collapsible nested in an item's body keeps its own default. A leading arrow also makes the label fill the row: the trigger is space-between, so with nothing after the label to absorb the free space it would otherwise be thrown to the far edge, leaving a gap behind the arrow. Co-authored-by: Cursor <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsCollapsible (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression2 of 2 shot(s) changed. View the report A repository maintainer can accept these exact frames: A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
chevronPlacement gains 'none': no chevron, and the trigger content is the whole button. For a trigger that already reads as openable — a category icon that becomes an arrow under the pointer, a caret drawn into a graphic — where the built-in chevron is a second affordance saying the same thing. The chevron was unconditional, and StyleX has no child selectors, so there was no reaching it from outside. The only way out was to stop using Collapsible and hand-roll the aria-expanded/aria-controls pair, which is the wiring most worth not hand-rolling. Semantics are untouched: still a button, still aria-expanded. One prop rather than a side plus a hasChevron boolean, because a side and 'no chevron' cannot both be true and two props would let a caller say so. Also drops the changeset from minor to patch: [feat] bumps patch while 0.x, which check:changesets enforces and this changeset was failing. Co-authored-by: Cursor <[email protected]>
Resolve the RTL audit exemption list: keep main's newer entries and drop core/Collapsible, which this branch removes now that the leading chevron is exercised by a real RTL story.
Resolve apps/storybook/rtl-audit/verified-not-applicable.json: main added Banner, ThreeD, Button and IconButton entries; this branch retires the core/Collapsible exemption because the leading-chevron work adds real RTL coverage for it. Keep main's list, minus core/Collapsible.
cixzhang
left a comment
There was a problem hiding this comment.
Thanks, the leading-chevron behavior is almost there. The current Collapsible contract limits this to chevronPosition?: 'start' | 'end'; this head instead exports chevronPlacement with none, which lets callers remove Collapsible’s visible disclosure affordance. Please rename the prop/type across Collapsible and CollapsibleGroup to chevronPosition / CollapsibleChevronPosition, remove none and its docs/tests/changeset text, and keep the existing start/end behavior.
[Reviewed by Robohands]
|
/accept-visual 34183876887/1 The leading chevrons match the current Collapsible contract: start precedes the label, mirrors inward in RTL, and points down when expanded; end remains the unchanged default. |
|
Visual changes accepted for |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks—the earlier chevronPlacement/none block is resolved. chevronPosition, the exported type, precedence, RTL behavior, and full-row labels now match the current Collapsible contract.
[Reviewed by Robohands]






What
CollapsibleandCollapsibleGrouptake achevronPlacementprop. The default,'end', is exactly what ships today;'start'moves the disclosure arrow ahead of the label.The leading arrow is the tree and file-browser convention — the one you want when a column of labels should line up behind the arrows. Until now only
TreeListand the Table row-expansion column could draw one, so a card or accordion header had no way to match them.Why the glyph changes with the side
A trailing chevron points down and flips up. A leading one points into the row and turns down. Rotating
chevronDowna quarter turn would leave the closed state pointing the wrong way, so'start'swaps inchevronRightand rotates 0° → 90°, mirrored in RTL. That is whatTreeListalready does, so the two now agree.Why the group carries it
A list whose arrows change sides row to row reads as a bug, so
CollapsibleGrouppasses the placement down through the same presentation context that already carrieshasDividersanddensity. An individual item still overrides its group, and a collapsible nested inside an item's body keeps its own default rather than inheriting.One layout consequence
A leading arrow also makes the trigger label fill the row. The trigger is
space-between: with a trailing arrow that rule is what separates the two, but with the arrow leading there is no third child to absorb the free space, so an unfilled label would be thrown to the opposite edge with a gap behind the arrow. Filling it also gives a trigger that spreads its own contents (hAlign="between"and the like) the whole row to spread across — which is what the screenshots above rely on.This overlaps with #5933, which makes the label fill unconditionally. The two are independent and either order merges; if #5933 lands first, the conditional style here becomes redundant and the rebase drops it.
Test plan
Collapsibletests pass, 7 of them new: DOM order for each side, that the glyph changes with the side rather than only the position, group inheritance, item-over-group override, no leak into a nested collapsible, and that the label fills the row when the arrow leads.tsc --noEmitandeslintclean onpackages/core/src/Collapsible.table-groupedtemplate withchevronPlacement="start"applied locally, light and dark.