fix(banner): status icon inherits color from the banner-icon wrapper so 'status:X' theme overrides reach it#4201
Open
jiunshinn wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
July 22, 2026 15:08
Contributor
PR Analysis ReportModified ComponentsBanner
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. Banner - 1 issue(s)
Generated by PR Enrichment workflow | View full report |
jiunshinn
marked this pull request as ready for review
July 22, 2026 15:30
jiunshinn
requested review from
cixzhang,
ejhammond and
imdreamrunner
as code owners
July 22, 2026 15:30
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.
Problem
Bannerrenders itsstatus="info"icon as<Icon color="accent">. The documented theming targetastryx-banner-icon(+'status:info') styles the wrapper div only — the inner.astryx-iconspan carries its owndata-color="accent"StyleX color (color: var(--color-accent)), so a'banner-icon'override that setscolornever reaches the glyph. On themes whose accent is not a calm blue (the reporter's accent is#DC2626red), every info banner ships a red (i) icon that is indistinguishable from an alert, with no recovery path inside the theme DSL.Root cause
packages/core/src/Banner/Banner.tsxmapped each status to an Icon color variant and passed it down:Iconthen setscolor: var(--color-accent)directly on the.astryx-iconspan. Since theme component overrides for'banner-icon'(emitted into@layer astryx-theme) target the wrapper element, and the span's owncolordeclaration beats inheritance, the override can restyle the wrapper but the SVG (stroke/fill: currentColor) keeps reading the span's hard-coded color.Fix — option (a): glyph inherits from the
banner-iconwrapperThe issue offered two directions:
currentColor/ inherits from.astryx-banner-iconso'status:info'overrides reach it — chosen--color-info, accent as fallback) that themes can set — not chosen hereImplementation: the status color default moves onto the wrapper (the
'banner-icon'theming target) via StyleX, using exactly the tokens the Icon variants resolved to before, and the defaultIconnow renderscolor="inherit":Why (a) over (b):
color: var(--color-accent)(info) / the semantic status tokens (others) — the same vars the Icon color variants used — and the glyph inherits throughcurrentColor. No theme, light/dark mode, or default render changes.--color-infotoken needs entries intokens.stylex.ts, the HCT palette derivation for custom themes, an Iconcolorunion member, and docs across Icon/tokens. The issue itself says the--color-infoidea "might deserve … a separate issue". (a) does not preclude (b): if a--color-infotoken lands later,statusIconColorStyles.infoswitches to it in one line.'status:info': {'--color-accent': 'var(--color-text-blue)'}). The wrapper resolves the samevar()inside the same subtree, so those overrides produce identical results.astryx-banner-icon+data-statustheming surface actually controls the glyph for every status instead of silently styling an invisible wrapper.icon == null), so a customiconnode keeps its current inherited color — no behavior change on that path.Before / after
Before (core 0.1.2, from the issue):
After (rendered by the updated test suite):
A theme's
'banner-icon': {'status:info': {color: '#67E8F9'}}override lands on the wrapper in@layer astryx-theme(above StyleX), and the glyph now follows it viainherit→currentColor. With no override, the computed color isvar(--color-accent)exactly as before.Test plan
pnpm exec vitest run packages/core/src/Banner— 36 passed (33 existing + 3 new)data-color="inherit"; (2) the info icon no longer carriesdata-color="accent"(regression pin); (3) the wrapper color class is applied only on the default-icon path, so custom icons keep their inherited color. All three fail against the previous implementation.pnpm -F @astryxdesign/core typecheck— cleaneslint src/Banner— clean.xqwr325→color: var(--color-accent)and.x1heor9g→color: inheritin the builtastryx.css, confirming the unchanged default color chain.Related (out of scope)
Badge variant="info"has the same accent-fallback semantics, but is recoverable today via'variant:info'overrides, so it is not touched here. If a--color-infotoken is introduced (issue's option (b)), both Banner and Badge could resolve through it as a follow-up.Reviewer questions
banner-iconwrapper). If you'd rather go straight to option (b) (--color-infotoken with accent fallback, plus the palette-derivation and Icon changes it implies), happy to rework — (a) was chosen as the minimal fix that keeps default rendering byte-identical and leaves the token design open.'banner-icon'+'status:X'overrides work uniformly, not just for info. If you prefer an info-only change (keepingdata-color="warning|error|success"on the sibling icons), that is a two-line narrowing..astryx-iconspan'sdata-colorchanges from the status variant to"inherit". Anything targeting e.g..astryx-icon[data-color="accent"]inside banners (outside the documented theming surface) would stop matching — flagged in case that surface matters to you.Fixes #4166