Skip to content

fix(slider): fill the track at the range ends and center the grips - #843

Merged
nandanmen merged 2 commits into
mainfrom
nanda/slider-edge-fixes
Oct 5, 2026
Merged

nandanmen merged 2 commits into
mainfrom
nanda/slider-edge-fixes

Conversation

@nandanmen

@nandanmen nandanmen commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes two layout bugs in the new Slider (#836):

  • At the maximum value, the indicator stopped about 8px short of the track's right edge, while the left edge was flush.
  • At the minimum value, the indicator was only half a thumb wide, and the grip sat at its left edge rather than in the middle.
Before After
Max
Min
Range at both ends

Causes

  • With thumbAlignment="edge", Base UI works out each thumb's position as a percentage of the Slider.Control's full width, padding included, then applies that percentage inside the Slider.Track. The control's 3px padding made the track 6px narrower, so thumbs landed slightly off at both ends.
  • Base UI ends the indicator at the thumb's center, so half a thumb was always left uncovered at the end.

Changes

  • The padding, ring and background (sliderVariants()) move from Slider.Control to a wrapper div. The control and track are now the same width, so the thumb positions match the pointer maths.
  • The indicator gets pr-2 (and -ml-2 pl-2 for ranges) with box-content!, so it covers whole thumbs: it fills the track at the max and is exactly one thumb wide at 0. box-content is forced because unlayered * { box-sizing: border-box } resets, like the docs site's, would otherwise beat the utility.
  • Grips no longer have the ±7px offsets, so each one is centered in its thumb.

Validation

Measured in the docs at a 282px track:

Indicator Grips
Match count at 5 (max) 0 to 282px 274px
Sampling rate at 0% 0 to 16px 8px
Price range at 0 to 100 0 to 282px 8px, 274px

The Slider unit tests (10), lint and format checks pass.

No new changeset: Slider hasn't been released yet, and .changeset/slider-component.md already covers it.

  • Reviews
  • bonk has reviewed the change
  • automated review not possible because: small visual fix, verified with before/after screenshots and DOM measurements
  • Tests
  • Tests included/updated
  • Automated tests not possible - manual testing has been completed as follows: measured indicator and grip positions at the min, max and range ends in the docs, before and after

🤖 Generated with Claude Code

Base UI positions edge-aligned thumbs as a percentage of the control's
full width, but the control's padding made the track narrower than that,
and the indicator stopped at the thumb's center. Move the padding to a
wrapper, stretch the indicator over the whole thumb, and center each grip
in its thumb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ask-bonk

ask-bonk Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@pkg-pr-new

pkg-pr-new Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/@cloudflare/kumo@843

commit: 2e842f1

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Visual contracts

Linux Chromium references exercised by the PR's visual-contracts job.

1 curated contract

truncating text trigger

truncating text trigger

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://nanda-slider-edge-fixes-kumo-docs.design-engineering.workers.dev (commit 2e842f1)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://aaf34e81-kumo-docs.design-engineering.workers.dev 2e842f1 2026-10-05T18:26:02.291Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://813a7275-kumo-docs.design-engineering.workers.dev 366bedc 2026-10-05T16:35:47.071Z Visit the dashboard ↗

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

📐 Bundle Size

Consumer fixtures bundled against packages/kumo/dist (peers external, minified ESM).

Fixture Raw Gzip Brotli
Button (root) 166.3 KB 50.9 KB 44.1 KB
Button (components/button) 166.2 KB 50.9 KB 44.1 KB
Button + Dialog + Select (root) 291.1 KB 86.8 KB 72.9 KB
Button + Dialog + Select (component subpaths) 291.1 KB 86.8 KB 72.8 KB
Chart (root) 238.6 KB 72.0 KB 61.8 KB
Chart (components/chart) 238.6 KB 72.0 KB 61.9 KB
Badge (components/badge) 36.5 KB 12.7 KB 11.1 KB
Flow (components/flow) 200.6 KB 59.2 KB 51.8 KB
Button (primitives/button) 12.2 KB 4.4 KB 3.9 KB
Primitives barrel 635.9 KB 176.9 KB 139.4 KB
Code highlighting (code) 2.07 MB 469.2 KB 350.4 KB

npm tarball: 551 files, 1.50 MB packed, 6.96 MB unpacked.

⚠️ 24 flagged files in tarball (tests / raw scripts)
  • dist/blocks-source/delete-resource/delete-resource.test.tsx
  • dist/blocks-source/resource-list/resource-list.test.tsx
  • scripts/component-registry/cache.ts
  • scripts/component-registry/discovery.ts
  • scripts/component-registry/example-cleanup.ts
  • scripts/component-registry/index.test.ts
  • scripts/component-registry/index.ts
  • scripts/component-registry/markdown-generator.ts
  • scripts/component-registry/metadata.ts
  • scripts/component-registry/props-filter.ts
  • scripts/component-registry/schema-generator.ts
  • scripts/component-registry/sub-components.ts
  • scripts/component-registry/types.ts
  • scripts/component-registry/utils.ts
  • scripts/component-registry/variant-parser.ts
  • scripts/css-build.ts
  • scripts/generate-globe-land-mask.mjs
  • scripts/generate-primitives.ts
  • scripts/theme-generator/config.ts
  • scripts/theme-generator/generate-css.test.ts
  • scripts/theme-generator/generate-css.ts
  • scripts/theme-generator/index.ts
  • scripts/theme-generator/migrate.ts
  • scripts/theme-generator/types.ts

Report-only: no size thresholds are enforced yet.

Commit: 2e842f1c

@nandanmen
nandanmen merged commit 10b7f66 into main Oct 5, 2026
19 of 21 checks passed
@nandanmen
nandanmen deleted the nanda/slider-edge-fixes branch October 5, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants