Skip to content

fix(registry): calmer elastic slider stretch and live reduced motion - #53

Merged
moshiur01 merged 1 commit into
mainfrom
fix/elastic-slider-a11y
Nov 17, 2026
Merged

moshiur01 merged 1 commit into
mainfrom
fix/elastic-slider-a11y

Conversation

@moshiur01

Copy link
Copy Markdown
Contributor

What

Follow-up to #50, based on Noman's review of the Elastic Slider.

  • Stretch stays, but smaller. Pulling past min or max still stretches the ruler, since that's how you see you've hit the limit. It's now capped at 10px, and each extra pixel of pull stretches it less (the old cap was 28px). The edge bump from the step buttons drops from 14px to 6px.
  • Quick, calm release. On release the ruler settles back in 320ms on power3.out, in one move with no wobble. Before, it was a 900ms elastic.out that swung back and forth.
  • Live reduced motion. prefers-reduced-motion is read through a matchMedia change listener, so switching it while the page is open turns off the stretch and tick wave straight away. The indicator stops right at the limit.
  • Native range input. It was already there: a real <input type="range"> with a <label> and aria-valuetext, controlled by the same value as the drawing. The docs now explain the keyboard keys (arrows, Page Up/Down, Home/End), what screen readers announce ("Monthly budget, slider, $7,500"), and the focus ring.
  • Tests.
    • The stretch never goes past MAX_STRETCH, and that cap is between 8 and 12px.
    • Dragging past max stretches the ruler but stays under the cap.
    • There's no stretch with reduced motion on.
    • There's no stretch after reduced motion is switched on while the page is open.

Notes for review

  • rubberBand and MAX_STRETCH are now named exports so the tests can check the cap directly.
  • Ticks and the track have data-elastic-tick / data-elastic-track so the tests can find them. Nothing changes visually.
  • I checked the reduced-motion tests catch a regression: with the reduced-motion check taken out of stretchTo, both of them fail.

Checks

  • pnpm registry:build passes
  • pnpm typecheck passes
  • Full test suite: 1400 tests pass
  • Not checked in a browser with DevTools reduced motion on and off

Review feedback: the stretch past the ends stays as the "you hit the
limit" cue, but it is now capped at 10px with diminishing returns and
settles back in 320ms on power3.out instead of a 900ms elastic wobble.
The edge bump from the step buttons drops from 14px to 6px.

Reduced motion is read from a matchMedia listener, so switching it while
the page is open turns the stretch and tick wave off straight away.

Docs spell out the native range input, keyboard and screen reader
behaviour. Tests cover the stretch cap, no stretch under reduced motion,
and switching reduced motion on live.

Co-Authored-By: Claude <noreply@anthropic.com>
@moshiur01
moshiur01 merged commit f5385d2 into main Nov 17, 2026
1 check passed
@moshiur01
moshiur01 deleted the fix/elastic-slider-a11y branch November 17, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant