Repository navigation
Conversation
Add a tree-level render prop to customize the expand/collapse
indicator. Called per item with {isExpanded, hasChildren, isDisabled}
so a file tree can show closed/open folder icons and a file icon in
the indicator slot of leaves. Custom icons swap per state (the chevron
rotation animation is suppressed); non-renderable returns fall back to
the default chevron for parents and to no indicator for leaves. The
toggle's a11y wiring (aria-expanded, aria-label, roving tabindex,
data-tree-toggle) is unchanged regardless of the icon.
Closes meta#4131
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| PowerSearch | 300.0 kB (+118 B) · 24.7 kB CSS (0) | — | — · — · — |
| TreeList · Storybook | 46.2 kB (+95 B) · 5.6 kB CSS (0) | 1,285 (+66) | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 7.38 MB packed (+3.7 kB); no new dependencies.
API changes: core +3 · ~0 · −0
3 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | core |
. · Components · component TreeList |
prop renderExpandIcon?: (state: TreeListExpandIconState) => ReactNode |
<TreeList renderExpandIcon={…} /> |
| + | core |
. · Types · interface TreeListExpandIconState |
interface TreeListExpandIconState |
import type {TreeListExpandIconState} from '@astryxdesign/core' |
| + | core |
./TreeList · Also exported from an earlier entry point · TreeListExpandIconState |
TreeListExpandIconState (.) |
import {TreeListExpandIconState} from '@astryxdesign/core/TreeList' |
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
cixzhang
left a comment
There was a problem hiding this comment.
Thanks for this — the state-aware swap and the leaf slot are exactly what the issue asked for, and the tests are thorough.
One thing before it lands. The indicator column sizes its glyph with fontSize: --spacing-4, which works because the default chevron is a 1em registry icon. An <Icon> carries its own rem box and ignores it, so the folder example draws 20px in the 16px column — and at the browser's large-text setting, 25px, with the label's gap gone. size="sm" only lines up at a 16px root.
It'll also need a merge with main — TreeList's chevron block moved since July.
Ideally I'd like the column and the glyph on one scale. Would making the column 1rem, so size="sm" tracks it, work — or would you rather the indicator size whatever it's handed?
If you'd rather talk it through with someone, we're in Discord.
[Reviewed by Robohands]
| }, | ||
| // Indicator slot for leaf items when renderExpandIcon supplies a leaf icon. | ||
| // Same metrics as the chevron toggle so leaves align, but non-interactive. | ||
| leafIconContainer: { |
There was a problem hiding this comment.
This sets the token box but an <Icon>'s own rem width wins. Glyph still overflows.
There was a problem hiding this comment.
Now the shared indicatorColumn box (1rem). An sm Icon fills it at any root font size.
| * items={items} | ||
| * renderExpandIcon={({isExpanded, hasChildren}) => | ||
| * hasChildren | ||
| * ? (isExpanded ? <Icon icon={FolderOpenIcon} /> : <Icon icon={FolderIcon} />) |
There was a problem hiding this comment.
This example is what people will copy. Might want a size on it once the column's settled.
There was a problem hiding this comment.
The example, the story and the docs now pass size="sm", and a guidance line in TreeList.doc.mjs spells out the 1rem column.
|
Checking in on TreeList indicators: the custom glyph and its column still need one size contract after merging main. Would you like to continue, have us carry it, or close this for now? |
Conflicts: TreeList.tsx, TreeListItem.tsx, TreeListTypes.ts, index.ts — resolved as a union of main's TreeListVariant / Icon-rendered chevron / flush-leaf column logic (meta#4838, meta#4540, meta#4530, meta#4334) and this branch's renderExpandIcon. A leaf that renders its own indicator no longer reserves the chevron column. The four alignment tests now read the published --_tree-indent custom property instead of the removed inline marginLeft.
…ta#4131) Review round for meta#4228. The indicator column (toggle, non-interactive chevron box, leaf slot) was --spacing-4, a 16px token, while <Icon> keeps its own rem box: the folder example drew 20px in a 16px column and 25px at a 20px root, with the label gap gone. The column is now 1rem, the same box as <Icon size="sm">, shared by one indicatorColumn style; the default chevron drops its --spacing-4 re-pin and lives on the same contract, and the null-leaf offset uses the same length so labels stay aligned at any root font size. A custom icon is now the column's direct child (no wrapper span), rendered as handed over: no rotation, no RTL mirror. Docs, story and changeset say size="sm". Tests read the compiled StyleX rules back (declarationsOf) to assert the shared 1rem box, the un-pinned chevron, the 1rem leaf offset, and the transform-free custom icon. Measured in Chrome: column/glyph 16/16 at a 16px root, 20/20 at a 20px root, overflow 0, label gap 4px at both.
|
Continuing. Round pushed at 7eb427e:
|
There was a problem hiding this comment.
Approval recommended. TreeList now supports the maintainer-requested renderExpandIcon for state-aware folder and file indicators — custom icons swap instead of rotating, non-renderable returns fall back to the default chevron or no leaf indicator, and the toggle's accessibility wiring is preserved. The indicator column, default chevron, leaf slot, and leaf offset now share the directed 1rem (Icon size="sm") box, so alignment holds at non-default root font sizes. Focused tests and the repository's test, lint, accessibility, RTL, and visual checks pass; please inspect the pending visual-acceptance report for the intentional indicator pixels before merging.
[Automated review]
There was a problem hiding this comment.
This change is on hold for a maintainer decision, not for a code defect.
The implementation is well supported: renderExpandIcon swaps state-aware parent icons, renders leaf icons in the indicator slot, falls back to the default chevron or no leaf indicator for non-renderable returns, preserves the toggle's accessibility wiring, and the focused tests and repository checks pass. No concrete defect was found.
Approval needs a maintainer to provide or identify the governing spec for this addition, or to record the ruling in the TreeList component record and approve this exact revision. What must be settled is: the tree-level renderExpandIcon prop and its exported state type, including leaf invocation, the fallback behaviour, and custom icons swapping instead of rotating; and the shared 1rem indicator column, which also changes the default chevron and leaf offset at non-default root font sizes. The feature request and review discussion show the maintainer's intent, but no current spec record yet covers these additions, so they cannot be approved on that discussion alone. No code change, removal, or split is being requested solely because of this hold.
[Automated review]
Resolved conflicts:
- packages/core/src/TreeList/TreeList.test.tsx: both sides appended tests at
the end of the top-level describe('TreeList'). Kept both: this branch's
describe('renderExpandIcon') block (with its closing brace), followed by
upstream's three consumer onKeyDown tests (meta#5606).
TreeList.tsx, TreeListItem.tsx, TreeListTypes.ts and TreeList.doc.mjs
auto-merged; the merged diff against upstream/main is only this PR's delta.
…eta#4131) X2: TreeListExpandIconState.isExpanded is documented as "Always false for leaf items", but a parent toggled open by the user keeps its override-map entry after its children are removed, so the now-leaf row called renderExpandIcon with {isExpanded: true, hasChildren: false}. The call site now passes `hasChildren && isExpanded`; expansion state and aria-expanded (already guarded by hasChildren) are untouched. Proof: new test "reports isExpanded false for a leaf whose expanded parent lost its children" (toggle open via the button, rerender with `children: []`) failed before the change with the last call receiving `isExpanded: true`, and passes after it.
|
/approve-spec 899ad05 |
There was a problem hiding this comment.
Changes requested: renderExpandIcon covers what #4131 asks for, the TreeList record change has an engineering owner's approval at this commit, and a tree without the prop keeps today's code path; one description fix remains.
Blocking
- The
## Writing rubric resultslines for R4 to R7 report "history", "status", "vague scope" and "duplication", but the rubric indocs/contributing/spec-writing.mdasks for R4 rejected alternatives, R5 change references, R6 open questions and R7 project status, so replace those four lines with the rubric's items (on the record lines this pull request adds, each readsnone).
Before merge
The changes-requested review an engineering owner left on an early commit stays in effect until that reviewer re-reviews or dismisses it, and CI has not run on this head while it is a draft. Two optional suggestions are inline: FR3's "renders unchanged" wording and a shorter comment in TreeListItem.tsx.
Claims and files checked
- Verified: the new prop is called for every row with its expanded, children and disabled state (
TreeListItem.tsx:551-559). - Verified: parents can show folder icons and leaves a file icon in the same column, with leaves lined up (
TreeListItem.tsx:578-579,694-698). - Verified: the result replaces only the chevron glyph, with no rotation or mirror, and a pointing glyph can read the direction hook from
@astryxdesign/core/i18n(TreeListItem.tsx:261-268,639-645;i18n/index.ts:41). - Verified: only
undefinedkeeps the default;null, booleans and''fill an empty box (TreeListItem.tsx:563, and the matching tests). - Verified: the result is hidden from assistive technology and inert, and the toggle keeps its name, state and keys (
TreeListItem.tsx:640,695). - Verified: icons should be
sm, since the column is the default chevron's--spacing-4box, 16px by default (tokens.stylex.ts:193,Icon.tsx:80-82). - Verified: trees without the prop render as before under every theme (every new branch needs a result other than
undefined; the chevron's styles are unchanged). - Verified: the state type is exported (
TreeList/index.ts:35), and the prop has the shape #4131 proposes, with per-item overrides left out. - Verified: the Custom Expand Icons story, the English, Chinese and dense docs, the size tests on the
--spacing-4box and the disabled-parent test. - Verified: the earlier
1remcolumn shrank the chevron from 24px to 16px under Matcha and Y2K, whose spacing step is 1.5rem. - Verified: the TreeList record names the caller's indicator, its fallbacks, the decorative rule, the Leaf indicator and a swap instead of a turn (FR1, FR3, FR8, AR1, anatomy, verification row), and the latest commit scopes FR8 and fixes two comments.
- Verified: the
renderExpandIconsuite has 32 tests at this commit; the 163 passing TreeList tests match a count of the test files but were not run here. - False: the writing-rubric results for R4 to R7 name checks the rubric does not define (blocking above); R1 to R3 answer the rubric.
- Not reproduced here: the first round's counts and mutation runs, full-suite counts, lint, type check, knowledge and changeset checks, the dense CLI render and the bundle size.
- Files:
.changeset/treelist-render-expand-icon.mdclear;apps/storybook/stories/TreeList.stories.tsxclear;docs/specs/components/TreeList/TreeList.spec.mdnon-blocking wording notes;packages/core/src/TreeList/TreeList.doc.mjsnon-blocking note on the Chevron glyph text;TreeList.test.tsxclear;TreeList.tsxclear;TreeListItem.tsxnon-blocking notes on a comment and the icon size default;TreeListTypes.tsclear;index.tsclear.
…mment Co-authored-by: AKnassa <[email protected]>
|
/approve-spec 29c2271 |
There was a problem hiding this comment.
Approval waits on one decision. An engineering owner left a changes-requested review on an early commit, asking for the indicator column and its glyph on one scale, and only that reviewer can re-review or dismiss it. Otherwise this commit checks out: the TreeList record change has an engineering owner's approval for this exact commit, the writing-rubric results now cover R1 to R7, and a tree without renderExpandIcon keeps today's code path. CI has not run on this commit while the pull request is a draft.
Three optional suggestions:
- Miss: FR3's "without rotation, RTL mirror or swap" reads against FR8's "swaps instead"; "without rotation, and without an RTL mirror or RTL swap" keeps the two apart (inline).
- An unsized
Iconin the indicator defaults tomdand overflows the 1rem box by 4px; giving the indicator boxes a defaultsmicon size would make the docs' sizing advice unnecessary (inline). - The Design relationships
Chevron glyphrow and the doc anatomy still describe the glyph as Icon's alone (inline on the doc anatomy).
Claims and files checked
- Verified: the prop is called for every row with its expanded, children and disabled state (
TreeListItem.tsx:551-559). - Verified: parents can show a closed or open folder and leaves a file icon in the same column, with leaves lined up (
TreeListItem.tsx:578-579,637-643,692-696). - Verified: the result replaces only the chevron glyph, with no rotation or mirror, and a pointing glyph can read the direction hook from
@astryxdesign/core/i18n. - Verified: only
undefinedkeeps the default;null, booleans and''fill an empty box (TreeListItem.tsx:563, and the matching tests). - Verified: the result is hidden from assistive technology and inert, and the toggle keeps its name, state, roving focus and keys (
TreeListItem.tsx:638,693,652-666). - Verified: icons should be
sm, since the column is the default chevron's--spacing-4box, 16px by default. - Verified: trees without the prop render as before under every theme; the default chevron's styles are unchanged, and a 1rem column would have shrunk it under Matcha and Y2K.
- Verified: the state type is exported from the package root and
./TreeList, and the prop has the shape the issue proposes, with per-item overrides left out. - Verified: the Custom Expand Icons story, the English, Chinese and dense docs, the size tests on the
--spacing-4box and the disabled-parent test. - Verified: the TreeList record names the caller's indicator, its fallbacks, the decorative rule, the Leaf indicator, a swap instead of a turn, and the test suite that verifies FR3.
- Verified: the
renderExpandIconsuite has 32 tests; the writing-rubric results answer R1 to R7 with the rubric's own items. - Not reproduced here: the passing test counts, red-first and mutation runs, lint, type check, knowledge and changeset checks, the dense CLI render and the bundle size.
- Files: the changeset, the story,
TreeList.tsx,TreeList.test.tsx(read, not run),TreeListTypes.tsandindex.tsare clear;TreeList.spec.md,TreeList.doc.mjsandTreeListItem.tsxcarry the optional notes above.
… and never widens the column The custom glyph box and the Leaf indicator keep the default Chevron's --spacing-4 box and font size, and clip a larger node, so 1em artwork fills the column at every text size and an unsized Icon cannot push the label. FR3, the docs, the example and the changeset say to draw glyphs at 1em. A browser spec measures the box, the artwork and the label gap at 100% and 200% root font size against the default chevron. Co-authored-by: AKnassa <[email protected]>
|
/approve-spec c74dbf9 |
|
Decision: D-20261112-384 |
There was a problem hiding this comment.
Changes requested: renderExpandIcon does what #4131 asks for, and an engineering owner approved the TreeList record change for this commit, but two claims in the description are wrong.
- The "Maintainer round 3" Guidance line says the old "size icons
sm" advice matched only at a 16px root, but Icon'ssmand--spacing-4are both1rem, so they matched at every text size in the default theme and differ only under themes that set--spacing-4to 1.5rem (Matcha, Y2K); please correct that reason. - Miss: the Proof line says the first round added 23 tests (48 → 71), but that commit adds 24 tests to
TreeList.test.tsx(47 → 71); please correct the count.
Approval also waits on the changes-requested review an engineering owner left on an early commit about sizing the indicator column and its glyph, which only that reviewer can re-review or dismiss. CI has not run on this commit while the pull request is a draft, so the new browser spec has not run yet. The inline notes on two comments in TreeListItem.tsx and an unused test parameter are optional, as is adding the new browser spec to the record's verified_by list.
Claims and files checked
- Changeset, verified: the new tree-level
renderExpandIconprop is called for each row with its expanded, children and disabled state (TreeList.tsx:187,TreeListItem.tsx:557-569). - Changeset, verified: parents can show a closed or open folder and leaves a file icon in the same column, and a leaf with an icon lines up with its parent (
TreeListItem.tsx:584-585,698-702). - Changeset, verified: the result replaces only the chevron glyph and is not rotated or mirrored (
TreeListItem.tsx:643-649);useDirection()is exported from@astryxdesign/core/i18n(i18n/index.ts:41). - Changeset, verified: only
undefinedkeeps the default, and any other result fills the box (TreeListItem.tsx:569). - Changeset, verified: the result is hidden from assistive technology and inert, and the toggle keeps its localized name,
aria-expandedand keys (TreeListItem.tsx:644,662,699). - Changeset, verified: the column is the default chevron's
--spacing-4box,1emartwork fills it and larger content is clipped (TreeListItem.tsx:264-286). - Changeset, verified: trees without the prop take the unchanged path (every new branch needs a result other than
undefined, and a test compares the markup), andTreeListExpandIconStateis exported (TreeList/index.ts:35). - Description, verified: the prop has the shape the issue proposed, leaves get the call, per-item overrides stay out, and the story is Core/TreeList, Custom Expand Icons.
- Description, verified: the maintainer rounds keep the contributor's commits unchanged, use the
--spacing-4box (a1rembox would shrink the chevron from 24px to 16px under Matcha and Y2K), drop1remfrom the docs and changeset, and amend the record's ownership, concept table, FR1, FR3, FR8, AR1, anatomy map and verification row. - Description, verified:
null,falseand''give an empty box; the decorative, right-to-left and unchanged-markup tests exist; the clip test fails without the clip; the writing-rubric results match the changed record lines. - Description, false: the first round added 24 tests (47 → 71), not 23 (48 → 71).
- Description, false:
smicons matched the box at every text size in the default theme, not only at a 16px root. - Description, not shown: that an unsized Icon pushed the label before this commit; the box already had a fixed width, so the clip changes what paints, not the layout.
- Description, stale: round 2's count of 32
renderExpandIcontests is 33 at this commit. - Not reproduced here: the passing test counts, red-first and mutation runs, lint, type check, knowledge and changeset checks, the dense CLI render, the bundle size and the browser spec's results.
- Files: the changeset, the story,
TreeList.tsx,TreeList.doc.mjs,TreeListTypes.ts,index.tsand the browser spec are clear;TreeListItem.tsx(two comments),TreeList.test.tsx(an unused parameter) andTreeList.spec.md(verified_byomits the new browser spec) have optional notes.
| // A caller's glyph inside the toggle, centred in the chevron column. | ||
| // A caller's glyph inside the toggle: the Chevron's box. Artwork drawn at | ||
| // `1em` fills it at every text size, and a larger node is clipped, so the | ||
| // column never widens. |
There was a problem hiding this comment.
Non-blocking: the first line is the comment this round replaced, so customGlyph now has two. Keep one, for example:
// The Chevron's box. Artwork drawn at `1em` fills it at every text size.
// A larger node is clipped, so the column never widens.| // the chevron's own dimensions, not the indent step, so it does not scale | ||
| // with the lever. Published as the private `--_tree-indent` and consumed by | ||
| // every row sits flush, like a parent at that level. A leaf that renders its | ||
| // own indicator (renderExpandIcon gave it an icon) fills the column itself, |
There was a problem hiding this comment.
Non-blocking: "(renderExpandIcon gave it an icon)" is narrower than the code. Any result other than undefined, null included, drops the offset (line 585). For example: "A leaf with a Leaf indicator (any renderExpandIcon result but undefined) fills the column itself, so it takes no offset either."
| render( | ||
| <TreeList | ||
| items={nestedItems} | ||
| renderExpandIcon={({hasChildren}) => <Icon icon={GlyphStub} />} |
There was a problem hiding this comment.
Nit: hasChildren is destructured but never read, which @typescript-eslint/no-unused-vars reports. renderExpandIcon={() => <Icon icon={GlyphStub} />} says the same thing.
kentonquatman
left a comment
There was a problem hiding this comment.
This looks good. Can you also add a block template to show an example of this? We have one for "File Tree With Icons" that serves a very similar use case. I think it will be helpful to show examples of the two types.
|
I'll run a full review to re-check this with your note. |
There was a problem hiding this comment.
This review finds no blocking defect: renderExpandIcon does what #4131 asks for, the TreeList record change has an engineering owner's approval for this commit, CI passes (including the new browser spec), and trees without the prop render exactly as before.
Approval waits on the two changes-requested reviews that are still open: kentonquatman's asks for a TreeList block template that shows renderExpandIcon beside "File Tree With Icons", and cixzhang's early review on sizing the indicator column and its glyph, which this commit addresses, needs her re-review or dismissal. The earlier inline notes on two comments in TreeListItem.tsx and an unused test parameter, and adding the new browser spec to the record's verified_by list, are optional.
Claims and files checked
- Changeset, verified: the new tree-level
renderExpandIconprop is called for each row with its expanded, children and disabled state (TreeList.tsx:187,TreeListItem.tsx:557-567). - Changeset, verified: parents can show a closed or open folder and leaves a file icon in the same column, and a leaf with an icon lines up with its parent (
TreeListItem.tsx:584-585,698-702). - Changeset, verified: the result replaces only the chevron glyph and is not rotated or mirrored (
TreeListItem.tsx:643-649);useDirection()is exported from@astryxdesign/core/i18n(i18n/index.ts:41). - Changeset, verified: only
undefinedkeeps the default, and any other result fills the box (TreeListItem.tsx:569). - Changeset, verified: the result is hidden from assistive technology and never focusable, and the toggle keeps its name,
aria-expandedand keys (TreeListItem.tsx:644,661-670,699). - Changeset, verified: the column is the default chevron's
--spacing-4box (16px by default),1emartwork fills it and larger content is clipped (TreeListItem.tsx:264-286, the new browser spec in CI). - Changeset, verified: trees without the prop render exactly as before (the unchanged-markup test, and identical frames before and after), and
TreeListExpandIconStateis exported (TreeList/index.ts:35). - Description, verified: the prop has the shape the issue proposed, leaves get the call, per-item overrides stay out, and the story is Core/TreeList, Custom Expand Icons.
- Description, verified: the first round added 24 tests to
TreeList.test.tsx(47 → 71). - Description, verified: the maintainer rounds keep the contributor's commits unchanged, use the
--spacing-4box (Iconsmand--spacing-4are both1remby default, and Matcha and Y2K set--spacing-4to1.5rem), dropsmand1remadvice from the docs and changeset, and amend the record's ownership, concept table, FR1, FR3, FR8, AR1, anatomy map and verification row. - Description, verified:
null,falseand''give an empty box; the decorative, right-to-left, clip and unchanged-markup tests exist; the new browser spec measures at 100% and 200% root size and passes in CI on this commit. - Description, stale: round 2's count of 32
renderExpandIcontests is 33 on this commit. - Description, not shown: that an unsized Icon pushed the label before this commit; the box already had a fixed width.
- Not reproduced: the local suite totals, mutation and red-first runs, and the bundle-size figures; CI's unit, lint and type-check jobs pass on this commit.
- Files: the changeset, the story,
TreeList.tsx,TreeList.doc.mjs,TreeListTypes.ts,index.tsand the browser spec are clear;TreeListItem.tsx(two comments),TreeList.test.tsx(an unused parameter) andTreeList.spec.md(verified_byomits the browser spec) have optional notes.
(Posted by Cindy's agent.) Dismissed as stale on the owner's decision: this review is on an outdated head. Please re-review the current head if concerns remain.
|
Thank you, @AKnassa, for this PR and for the careful write-up in #4131. The folder-and-file tree you described is a good use case, and your notes on rotation and right-to-left helped shape what Astryx now ships. Since this PR opened,
import {defineTheme, Theme} from '@astryxdesign/core/theme';
import type {IndicatorProps} from '@astryxdesign/core/Indicator';
import {TreeList} from '@astryxdesign/core/TreeList';
function FolderMark({state}: IndicatorProps<'disclosure'>) {
return state === 'expanded' ? <FolderOpenIcon aria-hidden /> : <FolderIcon aria-hidden />;
}
const fileTree = defineTheme({
name: 'file-tree',
indicators: {'tree-disclosure': FolderMark},
});
<Theme theme={fileTree}>
<TreeList
aria-label="Files"
items={[
{
id: 'src',
label: 'src',
children: [
{id: 'index', label: 'index.ts', startContent: <DocumentIcon aria-hidden />},
],
},
]}
/>
</Theme>A per-tree |
Closes #4131
What this does
Lets a
TreeListchoose its own expand/collapse icons instead of the built-in rotating chevron — so a file tree can show a closed folder that becomes an open folder, with file icons on the rows that can't expand.How
One new tree-level prop, with the shape proposed in the issue:
{isExpanded, hasChildren, isDisabled}(exported asTreeListExpandIconState). Leaves get the call too, so file trees can fill the indicator slot — rows with a leaf icon align to the indicator column.undefinedkeeps the default: the chevron for parents, and no indicator (with the usual alignment offset) for leaves. Any other result,nullincluded, fills the indicator box, which keeps the column's width when it renders nothing.aria-hiddenand inert, so it never joins a row's name or takes focus. The toggle's accessibility wiring is untouched regardless of the icon:aria-expanded, localizedaria-label, roving tabindex,data-tree-toggle.useDirection()from@astryxdesign/core/i18nto face the right way in right-to-left.Per-item overrides stay out, as the issue suggests ("could come later").
How to see it
Storybook → Core/TreeList → Custom Expand Icons





Proof
TreeList.test.tsx47 → 71), red-first for the feature, plus edge cases — disabled parents,children: [],isExpandedon leaves, Enter routing on clickable parents, string/empty returns, deep nesting, render-prop swap on re-render, ArrowLeft collapse. Six deliberate mutations each fail exactly one test.astryx component TreeList --dense; changeset included.Maintainer round (merge of main, review fixes, record)
Two commits on top; AKnassa's commits are unchanged.
TreeListItem.tsxandTreeList.test.tsxare resolved against main's TreeList work (guides aligned to chevrons, disabled rows asaria-disabled, the touch press changes,isRenderableslots).TreeListItem.renderExpandIconfills the Chevron, or a Leaf indicator for a leaf, in the default Chevron's own--spacing-4box.1remcolumn shrank the chevron from 24 px to 16 px under Matcha and Y2K.--spacing-4box; they failed on the previous head, which used1rem. The docs and changeset no longer describe a1remcolumn, and the disabled-parent test readsaria-disabled.component:TreeListFR1 and FR3 name the caller's indicator and its fallbacks.renderExpandIconsuite.TreeList tests pass (158), as do strict lint, the core type check, check-knowledge and check:changesets.
Maintainer round 2 (owner decision, a11y, fallback rule)
One commit on top; AKnassa's commits are unchanged.
renderExpandIconand the exportedTreeListExpandIconState({isExpanded, hasChildren, isDisabled}) stay as proposed.aria-hiddenand inert. Before, a labeled leaf icon could join the row's name.undefinedkeeps the default;null(andfalseor'') gives an empty box that keeps the column, one rule for parents and leaves. Before,nullfell back to the chevron.useDirection().component:TreeList): the Expand indicator row, FR3 and AR1 state the above, including "a rendered indicator is decorative".null,falseand''; the glyph and the leaf indicatoraria-hiddenand inert, with the toggle's name andaria-expandedkept. Also: the glyph renders untransformed in right-to-left, the default chevron still mirrors, and a render that returnsundefinedproduces the same markup as no prop. TreeList tests pass (163); lint is clean.mainand 43.7 KB here (+0.2 KB). A tree that doesn't pass the prop renders exactly as before.At this head the
renderExpandIconsuite has 32 tests, and the TreeList tests pass (163). A third commit scopes FR8's turning to the default Chevron glyph and fixes two internal comments.Writing rubric results
Run over the
component:TreeListchanges (the ownership lines, the Expand indicator row, FR1, FR3, FR8, AR1, the anatomy map, the consumer state table and the FR3 verification row):undefined". Every other line states the system in the present tense.renderExpandIconsuite.Maintainer round 3 (one scale for the column and the glyph)
One commit on top; AKnassa's commits are unchanged. It answers the owner's review asking for the indicator column and its glyph on one scale.
--spacing-4, with its font size), and clip a larger node, so the column never widens. Artwork drawn at1emfills the box at every text size, the same as the default chevron. An unsized<Icon>(20px by default) no longer pushes the label.1em(for example<FolderIcon width="1em" height="1em" />), in place of "size iconssm". Icon'ssmand--spacing-4are both1remin the default theme, but a theme that sets--spacing-4to another length (Matcha and Y2K use 1.5rem) parts them, while1emartwork follows the box in every theme.--spacing-4box at1em, and it fails on the previous head. A new browser spec,TreeListCustomIndicator.interaction.browser.spec.ts, measures at 100% and 200% root font size against the default chevron: 1em artwork fills the box, an unsized Icon (a story fixture hidden from the docs) keeps the column width, and the label keeps the default gap. TreeList's unit tests pass (164); I did not build Storybook locally, so CI runs the browser spec.Chevron glyphrow and the doc anatomy say arenderExpandIconresult takes its place.