Skip to content

fix(core): make Slider track color visible on muted backgrounds#3158

Merged
thedjpetersen merged 2 commits into
mainfrom
navi/fix/issue-2876-slider-track-and-docsite
Jun 27, 2026
Merged

fix(core): make Slider track color visible on muted backgrounds#3158
thedjpetersen merged 2 commits into
mainfrom
navi/fix/issue-2876-slider-track-and-docsite

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

The bug (#2876)

XDSSlider had three issues:

  1. Track color invisible on muted backgrounds. The default track color
    (not the fill) was painted with --color-background-muted — the very token
    used for muted surface fills — so the track disappeared against muted
    backgrounds.
  2. Showcase example was not interactive. The showcase block rendered a
    static value={50} with no onChange, so the thumb could not move.
  3. Properties-tab example needed a width and interactivity. The docsite
    properties-tab preview had no defined width, leaving the track without room
    to render or be dragged.

Reproduction (track color — part 1)

Added a unit test that resolves the rendered .astryx-slider-track element's
StyleX class back to its injected background-color rule and asserts it uses
the visible channel token.

  • Before the fix the test fails:
    AssertionError: expected 'var(--color-background-muted)' not to contain '--color-background-muted'
    Expected: "--color-background-muted"
    Received: "var(--color-background-muted)"
    
  • After the fix all 22 Slider tests pass.

Root cause

styles.track.backgroundColor was set to colorVars['--color-background-muted'].
That token is the muted surface fill, so a slim track painted with it has no
contrast against muted backgrounds. The design system already ships a dedicated
"channel on body" token, --color-track (light-dark(#CCD3DB, #5A5E66)),
explicitly intended for slider rails / progress tracks that must read against
body and muted surfaces.

The fix

  • Track color (part 1): track backgroundColor now uses --color-track.
  • Showcase (part 2): the showcase block manages its own state via onChange
    so the slider is draggable.
  • Properties tab (part 3): the doc playground.defaults now set an explicit
    width: 300 so the track renders with room to drag and stays interactive.

Closes #2876

@vercel

vercel Bot commented Jun 26, 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, Comment Jun 27, 2026 10:37pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 26, 2026
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🚀 Vercel Preview Deployment

Status ✅ Deployed
Preview Open Preview
Commit 9b6b456
Inspect Vercel Dashboard
Workflow View Logs

No authentication required — anyone with the link can view the preview.

@github-actions

github-actions Bot commented Jun 26, 2026

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.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


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

github-actions Bot added a commit that referenced this pull request Jun 26, 2026
* Resolve the `background-color` value an element's classes map to in the
* injected StyleX stylesheet (returns the raw `var(--token)` reference).
*/
function resolveBackgroundColor(el: HTMLElement): string | undefined {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not necessary to have a behavior test for these visual ones. We will inspect it manually and evaluate the token usage.

@thedjpetersen thedjpetersen enabled auto-merge (squash) June 27, 2026 16:10
cixzhang added 2 commits June 27, 2026 22:33
The default background track used --color-background-muted, the same token
as muted surface fills, so the track vanished on muted backgrounds. Switch
it to the dedicated --color-track channel token, which is built to stay
legible against body/muted surfaces.

Also make the docsite Slider examples interactive: the showcase block now
holds its own state via onChange, and the properties-tab preview gets an
explicit width so the track has room to render and stays draggable.

Closes #2876
@cixzhang cixzhang force-pushed the navi/fix/issue-2876-slider-track-and-docsite branch from 9b6b456 to 16d2932 Compare June 27, 2026 22:34
@thedjpetersen thedjpetersen merged commit 1ebdb95 into main Jun 27, 2026
16 checks passed
github-actions Bot added a commit that referenced this pull request Jun 27, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XDSSlider: track color invisible on muted backgrounds, non-interactive showcase, properties-tab example needs width + interactivity

2 participants