From afd4f650ebfb271c5a2201400961237db0324966 Mon Sep 17 00:00:00 2001 From: moshiur01 Date: Tue, 17 Nov 2026 11:09:34 +0600 Subject: [PATCH] fix(registry): calmer elastic slider stretch and live reduced motion 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 --- .../content/1.component/elastic-slider.mdx | 39 ++++--- apps/docs/public/r/elastic-slider.json | 2 +- apps/docs/registry/__sources__.generated.ts | 4 +- apps/docs/registry/tweenui/elastic-slider.tsx | 42 ++++--- apps/docs/tests/elastic-slider.test.tsx | 110 ++++++++++++++++-- 5 files changed, 157 insertions(+), 40 deletions(-) diff --git a/apps/docs/content/1.component/elastic-slider.mdx b/apps/docs/content/1.component/elastic-slider.mdx index fafd232..8efde2d 100644 --- a/apps/docs/content/1.component/elastic-slider.mdx +++ b/apps/docs/content/1.component/elastic-slider.mdx @@ -72,11 +72,14 @@ export default function Page() { the value when you leave, on a 500ms `power3.out` ease. - **Indicator.** Follows the value on a 400ms `power3.out` ease, so button presses and arrow keys glide instead of jumping. -- **Stretch.** Overdrag runs through a rubber-band curve that tops out at - 28px. The ruler is pinned at the far end, so ticks near your pointer move - the most. On release it springs back on `elastic.out(1, 0.32)` over 900ms. -- **Buttons.** The icon pops on `back.out`. At the limit the ruler kicks - 14px toward the button and springs back. +- **Stretch.** The stretch is how the slider tells you you've hit the + limit. Overdrag runs through a rubber-band curve that never goes past + 10px, however far you pull, and each extra pixel of pull stretches it + less. The ruler is pinned at the far end, so ticks near your pointer move + the most. On release it settles back in 320ms on `power3.out`, in one + move with no wobble. +- **Buttons.** The icon pops on `back.out`. At the limit the ruler gives a + 6px kick toward the button and settles back. ## Props @@ -104,14 +107,22 @@ The accent comes from `--elastic-accent`. Override it with a class, e.g. ## Accessibility ::note -Under `prefers-reduced-motion: reduce` the ticks stay flat, the ruler never -stretches, the indicator jumps straight to the value and the digits change -without rolling. +Under `prefers-reduced-motion: reduce` the ruler never stretches and the +ticks stay flat. The indicator jumps straight to the value and stops at the +limit, and the digits change without rolling. The slider listens for the +setting, so switching it while the page is open takes effect right away. :: -Under the ruler sits a real `` with a `