Repository navigation
Conversation
The row's content wrapper is the `astryx-tree-list-item` theme target, and its per-level indent was applied as an inline `margin-inline-start`. An inline longhand outranks every cascade layer, so `@layer astryx-theme` could never win against it — the indent sat outside the theming contract entirely and consumers had to reach for `!important` or unlayered CSS. The row now publishes only the computed distance as `--_tree-indent` and `margin-inline-start` is declared in `styles.contentWrapper`, which lands in `@layer astryx-base` where the theme layer can override it normally. A custom property carries a value, not a declaration, so it does not create the same specificity floor. Rendering is unchanged at every nesting depth, including the extra chevron-width offset leaves carry so their labels align with sibling parents. This is Option A of the RFC only. Option B (moving the indent onto an outer element so the highlight can span the full row) is a DOM-structure change with back-compat and visual-regression risk, and Option C (an `indentSize` prop) is new public API. Both are calls for maintainers, not consequences of fixing the cascade bug. `TreeList.test.tsx`'s noGuides indentation test asserted the inline longhand directly, so it now reads the variable instead; its intent — indent survives when connectors are suppressed, and grows with depth — is unchanged. Refs meta#4308
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis ReportModified ComponentsTreeList
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | View full report |
|
Thanks so much for this, @AKnassa — your write-up of the root cause was spot on: the indent was pinned to an inline We landed a forward fix in #4530 that builds on the same Option A cascade change you identified, and also takes you up on the offer at the end of your description — publishing the per-level step as a documented, public lever ( Since #4530 covers this ground, I'm going to close this PR — but the diagnosis here is what got us there, so thank you. Hope to see more contributions from you. 🙏 |
Summary
Implements Option A of RFC #4308, and only Option A.
TreeListItemapplied the per-level indent as an inlinemargin-inline-starton the row's content wrapper — the same element that carries theastryx-tree-list-itemtheme target. An inline longhand outranks every cascade layer, so a rule in@layer astryx-themecould never win against it. The indent was outside the theming contract entirely, and consumers were pushed into!important/unlayered CSS.A custom property carries a value, not a declaration, so it doesn't create the same specificity floor.
margin-inline-startnow lives in@layer astryx-basewhere the theme layer overrides it in normal cascade order.Rendering is unchanged at every nesting depth, including the extra chevron-width offset leaves carry so their labels line up with sibling parents' labels.
What this does not do
RFC consequence (1) is a cascade bug — a themeable surface that no sanctioned channel can reach — so fixing it doesn't need a decision. The other two do, and I've left them alone:
indentSizeprop, consequence 4) is new public API.Consequence (3) — per-level insets not derivable in
calc()becausedata-tree-levellives on the<li>rather than the themed element — is unchanged by this PR, and as the RFC notes it isn't fully resolvable in pure CSS while that stays true.Naming: I used the private
--_tree-indent, matching the file's existing--_tree-focus-outlineconvention, since the per-row value is an implementation detail — what becomes theme-reachable is themargin-inline-startdeclaration, not the variable. If you'd rather publish it as a documented--astryx-*lever (a second, finer control), that's a one-line rename and I'm happy to make it.Tests
New
TreeListItem.indentReachable.test.tsx— 5 tests pinning the two facts the fix rests on: no inlinemargin-inline-start/margin-lefton the themed row at any depth, and a stylesheet rule declaringmargin-inline-startfrom the variable. They deliberately don't depend on jsdom resolving@layerprecedence, which it doesn't do reliably — the assertions are about where the declaration lives, which is the part that determines the outcome in a real browser.TreeList.test.tsx's noGuides indentation test asserted the inline longhand directly, so it now reads the variable. Its intent is unchanged: indent survives when connectors are suppressed, and grows with depth.Mutation-checked: restoring the inline longhand fails 5 tests.
All 69 TreeList tests green.
pnpm check:repo, eslint andtsc --noEmitclean.