Skip to content

fix(treelist): leaf row highlight flush with sibling parents (trial) - #4570

Closed
freddymeta wants to merge 1 commit into
mainfrom
fix/treelist-leaf-highlight-flush
Closed

freddymeta wants to merge 1 commit into
mainfrom
fix/treelist-leaf-highlight-flush

Conversation

@freddymeta

Copy link
Copy Markdown
Contributor

What

A trial to see how "flush to guide" reads. This makes a leaf row's hover / selected / focus highlight start at the same x as its sibling parent rows (the guide/toggle column) instead of being inset past them by the chevron column. No new prop — it fixes the default.

The inconsistency today

The per-level indent lives on the row's outer margin-inline-start. Parents use level * step, but leaves add the chevron-column offset (spacing-4 + spacing-2) into that same margin so their labels line up under sibling parents. Side effect: a leaf's entire row box — and therefore its highlight — begins one toggle-column further in than a parent at the same level. Within a level, leaf highlights look inset relative to parent highlights.

The change

Move the leaf's chevron-column offset from the row margin to the content padding-inline-start:

  • Every row box now starts at level * step (parents and leaves alike) → highlights are flush to the guide column.
  • A leaf re-insets only its content via padding, so labels stay exactly where they were.

Label x is unchanged (verified algebraically: old margin + basePad sum == new padding sum); only the highlighted row box moves. padding-inline-start is a longhand, so it wins over contentWrapper's paddingInline shorthand via StyleX's longhand>shorthand priority — order-independent, no !important.

Notes / open question

  • Trial PR — sharing to eyeball whether flush-to-guide is the right look before committing to it. I did not add a variant (per the ask); it changes the default leaf alignment of the highlight box.
  • This is the more targeted alternative to the full-bleed feat(treelist): flush leaves in all-leaf groups + themeable inter-row gap #4540 (which stretches edge-to-edge). They're mutually informative — pick whichever reads better; I can close the other.
  • Storybook preview on this PR shows it live (TreeList stories with mixed parent/leaf rows).

Testing

  • TreeList suite: 68 passed (incl. 2 new — a leaf and a parent at the same level publish the same row indent; the chevron offset no longer lands in the leaf row box).
  • typecheck:docs, check-sync, sync-exports --check, changeset check, eslint — all green.
  • Verified emitted CSS: leaf content padding = calc(var(--spacing-2) + var(--spacing-4) + var(--spacing-2)); row margin stays var(--_tree-indent).

A leaf row's hover/selected/focus highlight started inset past its
sibling parent rows: leaves folded the chevron-column offset
(chevron width + gap) into the row's outer margin, so a leaf's whole row
box — and its highlight — began one toggle-column further in than a
parent at the same level.

Move that offset from the row's margin to the content's
padding-inline-start. Now every row's box starts at `level * step`
(flush to the guide/toggle column for parents and leaves alike), while a
leaf re-insets only its content so labels stay aligned with parents. The
label x is unchanged (verified: margin+basePad for old == padding for
new); only the highlighted row box moves, so leaves and parents now share
one highlight start.

`padding-inline-start` is a longhand and wins over `contentWrapper`'s
`paddingInline` shorthand via StyleX's longhand>shorthand priority
(order-independent, no !important). Purely visual; no API change.

Adds tests pinning that a leaf and a parent at the same level publish the
same row indent and that the chevron-column offset no longer lands in the
leaf row box.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 31, 2026
@vercel

vercel Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Jul 31, 2026 1:44am

Request Review

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

TreeList (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 764 -
Complexity N/A Very High (78) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@freddymeta

Copy link
Copy Markdown
Contributor Author

Dropping this in favor of #4540 — folding the leaf-flush alignment into the structural full-width row-box rework there (per review direction on #4540), so the whole thing lands as one coherent change rather than two overlapping ones.

@freddymeta freddymeta closed this Jul 31, 2026
@github-actions
github-actions Bot deleted the fix/treelist-leaf-highlight-flush branch July 31, 2026 07:03

This branch was successfully deployed

1 active deployment
Preview — 53bfdd01 Deployed Jul 31, 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. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant