Repository navigation
fix(core): drop styling wrappers around icons; render glyphs through Icon - #4838
Merged
Merged
Conversation
cixzhang
requested review from
humbertovirtudes and
imdreamrunner
as code owners
August 9, 2026 00:04
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
August 9, 2026 00:04
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBanner (@astryxdesign/core) · View in Storybook
Breadcrumbs (@astryxdesign/core) · View in Storybook
Chat (@astryxdesign/core) · View in Storybook
CodeBlock (@astryxdesign/core) · View in Storybook
Collapsible (@astryxdesign/core) · View in Storybook
ComplexSelector (@astryxdesign/core) · View in Storybook
MultiSelector (@astryxdesign/core) · View in Storybook
Selector (@astryxdesign/core) · View in Storybook
SideNav (@astryxdesign/core) · View in Storybook
TabList (@astryxdesign/core) · View in Storybook
Table (@astryxdesign/core) · View in Storybook
TopNav (@astryxdesign/core) · View in Storybook
TreeList (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 3 accessibility violation(s) found — 2 serious, 1 moderate. Banner - 1 issue(s)
Chat - 1 issue(s)
TabList - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
ernestt
added a commit
that referenced
this pull request
Aug 10, 2026
Keep triggerGhost/triggerGhostDisabled styles from this PR, adopt main's unwrapped Icon pattern (color="secondary", no wrapper span) from #4838.
This was referenced Aug 10, 2026
5 tasks done
humbertovirtudes
pushed a commit
that referenced
this pull request
Aug 18, 2026
* fix(Table): mirror the row-expansion chevron under RTL The row-expansion chevron rotated 90deg on expand with no RTL handling at all, so the glyph pointed the same direction regardless of text direction. Flagged by the weekly full-suite RTL audit (#5141, D1 icon-mirror) against TableRowExpansion and TreeList. TreeListItem's chevron already has the correct pattern for this exact shape (rotate + directional glyph): fold the RTL mirror into each state's own transform rather than a separate wrapper, since both are `transform` and a later declaration on the same element would win. Applied the identical pattern here. Also fixed the context-menu action's icon, which swaps between chevronDown (expanded, no mirroring needed) and chevronRight (collapsed, directional) instead of rotating -- chevronRight needs rtlStyles.mirror in the collapsed state, matching the convention used by Pagination/Carousel/Lightbox/Calendar for static directional chevrons. TreeList's own instance already has the correct mirror (verified: it is the only chevron render site in that directory, landed in #4838, uses the exact fold-into-transform pattern this PR now matches) -- the audit's "treelist" finding may be stale or probing a state this source-level check can't reproduce; nothing to fix there that I could find. * chore: add changeset for row-expansion RTL chevron fix
AKnassa
added a commit
to AKnassa/astryx
that referenced
this pull request
Aug 27, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A state-driven rotation — the chevron that turns when a section opens — is part of how the glyph looks in that state. Across core it lived on a styling wrapper while the component's icon theme target sat on the glyph inside it, so the element a theme could reach and the element that actually moved were two different nodes.
Selectorshows the split exactly: its chevron<Icon>already carriedthemeProps('selector-indicator-icon', {state})with a comment explaining that same-element rules in@layer astryx-themebeat the icon's own base styles — butrotate(180deg)sat on the wrapper span above it.Most of those wrappers turned out to exist only to host the transform. Remove the reason and there is nothing left to keep.
What
No new theme targets. This is wrapper removal and consolidation onto targets that already exist:
<Icon>that already carries*-indicator-icon. One selector now reaches the glyph's colour, size, and its transform. Also dropstriggerIconStatus(atransition: noneoverride that existed only to suppress the wrapper's rotation transition for status icons, and is dead once the transition rides on the chevron itself).inline-flex, and the real layout (24×24 box, centering, hover chrome) lives on the buttons, which are untouched.Folding the RTL mirror. Where
rtlStyles.mirrorsat on a separate parent, it is folded into each state's transform, becausetransformis one property and on a single element the later value would win:Composite matrix is identical to the nested pair at every point of the transition, in both directions.
New lint rule —
@astryx/no-wrapper-transform(warn). Fails a<div>/<span>that exists to apply a transform to the icon inside it. Deliberately narrower than the existingno-style-only-wrapper, which fires only when a wrapper can be deleted outright: a transform wrapper often also does real layout, which exempts it there, but the transform still belongs on the child. It matches only an icon child (a name ending inIcon, or auseIcon()binding) — a transform around a non-glyph component is usually positioning the wrapper's own box, which is why Carousel's floating button pill is correctly left alone.It ships as warn, not error, because it currently reports the
useIcon()call sites (SideNav, TopNav, Collapsible) that this PR deliberately leaves alone — see below.Second commit: render glyphs through
<Icon>, not a styling spanSideNav, TopNav, Collapsible, TreeList and Breadcrumbs called
useIcon(name)for a bareReactNodeand rendered it inside a hand-written<span>holding the styles. That span is a weaker reimplementation of<Icon>, which already resolves the same glyph and renders a span carrying mergedclassName/style/xstyleplus the pre-existingastryx-icontheme target. Converting is why those sites had no targetable element: they had opted out of the component that provides one.Node count is unchanged (span + glyph either way) and no new theme targets are added —
astryx-iconalready exists.I first went the other way and drafted
useIcon(name, props)withcloneElement. Lint rejected it —@astryx/no-react-introspectionbanscloneElementand.propsreads, pointing at "a wrapper component" instead — and that component already existed. The API change was abandoned before it went anywhere.useIcon()keeps its place for resolving a glyph without rendering it:MoreMenuandChatSendButtonhand the node to another component as the default for a consumer-overridable prop, which<Icon>cannot express.The sizing trap, since it nearly caused a silent regression. These glyphs are
width/height: 1emSVGs, and their wrappers set a box but nofont-size— so the glyph rendered at the inherited 14px inside a 24px or 28px box.<Icon>setsfont-sizealongside width/height, so a naive conversion would have inflated every chevron (14px → 24px inSideNavItem). Each converted site pinsfontSize: 'inherit'(or the exact type-scale token) so the rendered glyph is unchanged; the boxes that match no Icon size keep their exact dimensions inxstyle.Two wrappers deliberately survive:
SideNavHeading's andTopNavHeading's chevron buttons carryaria-label,onClickandpopover.triggerProps— they are triggers, not styling wrappers, and<Icon>renders a span.SideNavCollapseButtonkeeps its RTL mirror span, becausertlStyles.mirrormust stay outside the state rotation.With the conversion done,
@astryx/no-wrapper-transformreports zero findings in core, so it ships as error rather than warn.Risk
Default appearance is unchanged. Two behaviour notes, both improvements, both measured:
<span>(display: inline), andtransformdoes not apply to a non-replaced inline box — so those chevrons never mirrored in RTL. Folding the mirror onto the icon makes it take effect.Visual verification
Two Storybook dev servers — detached
origin/mainvs this branch — screenshotted with Playwright at 2×, LTR and RTL, disclosure toggles clicked so both states appear in frame.Re-run after the
<Icon>conversion, which is where the pixel risk actually lived:TreeList— before / after, 0 differing pixels:Tablerow expansion — the 23 changed pixels. Cropping the region to a luminance grid shows the same glyph one device pixel lower, i.e. the centering fix, not a reshape:Third commit: the RTL audit was testing the old structure
pr-rtlfailed on the first push, and it was right to notice something changed — but it was asserting the wrong thing.isFlipMatrixlooked for one element whose computed transform is a purematrix(-1,0,0,1). Once the mirror is folded into the same declaration as the rotation, no single element reads as a flip, even though the composition renders identically to the nested form.The audit now composes the transform chain from the glyph upward and asserts the general contract:
which holds for both shapes:
identitymatrix(-1, 0, 0, 1)rotate(90°)matrix(0, 1, 1, 0)Verified both directions rather than just the happy one: on this branch
treelistgoes fromAUTO FAILtoAUTO PASS(1 pass / 0 fail); withscaleX(-1)deleted from the folded transforms it returns toAUTO FAIL. So the check still catches a genuinely unmirrored glyph — it just no longer fails a correct one for its DOM shape.The double-flip heuristic is narrowed to match: it now fires only when the LTR and RTL matrices are actually equal, rather than whenever both happen to contain a flip.
Testing
pnpm -F @astryxdesign/core typecheck·pnpm -F @astryxdesign/core lint— 0 errors, 12 warnings, all pre-existingno-style-only-wrapperreports on main.no-wrapper-transformreports nothing, so it ships aserror.pnpm exec vitest run --project uiover TreeList, Table, Banner, CodeBlock, TabList, Chat, Selector, MultiSelector, ComplexSelector and thethemingTargetsguard — 1269 passing.Table.perfbudget failures reproduce on cleanmain; theTabListkeyboard-nav anduseTableFilteringfailures pass twice in isolation (parallel-load flake).pnpm exec vitest run --project node internal/eslint-plugin-astryx/no-wrapper-transform.test.mjs— 18 cases, including the Carousel-shaped false positive as an explicitvalidcase.