Skip to content

fix: sliders that could not reach their own ends, and cards that ate slider clicks - #9

Merged
DoodleBears merged 1 commit into
mainfrom
fix/slider-range-and-card-clicking
Sep 30, 2026
Merged

DoodleBears merged 1 commit into
mainfrom
fix/slider-range-and-card-clicking

Conversation

@DoodleBears

@DoodleBears DoodleBears commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

Two reports, both real, both found by writing the failing test first:

  1. "Some sliders' bounds seem wrong — values that max at 1 can only sit at the far left."
  2. "Chasing and Morphing often will not click."

Cause

1a. PercentSlider clamped every slider at the middle of its own track.
value={Math.round(clamp(fraction, 0, 1) * 100)} pinned the thumb at track 100
regardless of the track's max. Speed (max: 300) reached a third of its travel; stagger,
gap x and gap y (max: 200) half of theirs — and the dead half is exactly where the dots
overlap and where a per-dot delay exceeds the cycle, which is the range the control is for.

1b. And every call site divided by 100 a second time. PercentSlider already converts
the track value back to a 0…1 fraction before onChange; softness, grow, floor, gap x and
gap y each divided again. So those options were set to 1/100th of what the track said —
softness at the far right was 0.01, grow was 0.005. This is the same
raw-fraction-against-a-hundredths-track defect the repo already records for three other
sliders, back wearing a different hat. Both halves ship together: either alone leaves a
slider lying about its range.

2. Cards past the end of a scrolling row stole clicks from the sliders. Chasing and
Morphing were clickable; the cards past them were not. overflow-x: auto scrolls and
clips the painting, but the outgoing cards stayed hit-testable past the row's right
edge — over .playground-field, which comes later in the DOM and therefore won the click.
Breathing, Morphing and off rendered, looked selectable, and swallowed nothing: the
slider underneath took every click. contain: paint stops the escape.

Special things to note

  • Reversibility: one clamp expression, five onChange call sites, one CSS declaration.
    Site-only. Review focus is PercentSlider — the unit contract between it and its callers.
  • Verified two different ways, deliberately. The slider fix is asserted by behaviour:
    a test drives every slider to its declared min and max and fails if it stops short. The
    card fix is asserted against the stylesheet, because jsdom loads no CSS and
    getComputedStyle returned empty for every property — so the regression test checks that
    contain: paint is still declared. That is weaker than measuring, and the measurement that
    found the bug (document.elementFromPoint inside the overlap, in a real browser) cannot run
    in jsdom. The gap is named rather than papered over.
  • On the "chasing is laggy" half — I did not find a defect, and I want to be explicit about
    that rather than quietly closing the report.
    stagger and softness do reach the CSS
    renderer: field.ts sets --botui-seed from the spread and the stylesheet delays each cell
    by it, so the per-dot delay is real. What makes chasing look unsmooth is that it is a
    uniform highlight sweeping a ring, and a uniform sweep has nothing to interpolate. If it
    reads badly, that is the motion, not the plumbing — switching the renderer back to SVG is a
    one-click A/B on the page.
  • 154 tests (was 152), oxlint 0, oxfmt clean, registry ok.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Sliders now reach their full configured range, including values above 100.
    • Card grids are clipped within their layout, preventing overflow from interfering with adjacent sliders. Horizontal scrolling and snap behavior remain available.

…slider clicks

Two reports, two root causes, both found by writing the failing test first.

**Every PercentSlider was clamped at the middle of its own track.**
`value={Math.round(clamp(fraction, 0, 1) * 100)}` pinned the thumb at track 100 no
matter what the track's `max` was. Speed (max 300) could reach a third of its travel,
stagger and gap x and gap y (max 200) half of theirs — and the half that did nothing is
exactly where the dots overlap and where a per-dot delay is wider than the cycle, which
is the range the control exists for. Clamping against the track's own top fixes it.

**And each call site divided by 100 a second time.** `PercentSlider` already converts
the track value back to a 0…1 fraction before handing it to `onChange`; softness, grow,
floor, gap x and gap y were each dividing again. So every one of those options was set to
1/100th of what the track said — softness at the far right was 0.01, grow was 0.005. This
is the same raw-fraction-against-a-hundredths-track defect the repo already records for
three other sliders, and it had come back wearing a different hat. Both halves of it are
in one commit because either alone leaves a slider lying about its range.

**Cards past the end of a scrolling row stole clicks from the sliders.** Reported as
"Chasing and Morphing often will not click" — those two were fine; the cards PAST them
were not. `overflow-x: auto` scrolls and clips the PAINTING, but the outgoing cards stayed
hit-testable past the row's right edge, over `.playground-field`, which comes later in
the DOM and therefore won the click. Breathing, Morphing and `off` rendered, looked
selectable, and swallowed nothing: the slider underneath took every click. `contain: paint`
stops the escape.

Found by hit-testing with `document.elementFromPoint` inside the overlap, not by looking —
a screenshot of that state looks like a working row. The regression test asserts the
DECLARATION rather than the hit test, because jsdom loads no CSS and `getComputedStyle`
returned empty for everything; reading the stylesheet is weaker than measuring, and the
measurement cannot run in jsdom. What it does catch is an edit that drops `contain: paint`.

Not fixed here, because it is a design question and not a defect: **`stagger` and
`softness` do reach the CSS renderer** — `field.ts` sets `--botui-seed` from the spread,
and the stylesheet delays each cell by it. What makes `chasing` look unsmooth is that it
is a uniform highlight sweeping a ring, and a uniform sweep has nothing to interpolate.
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 431e813a-f3e5-4530-83ee-b7e255b53238

📥 Commits

Reviewing files that changed from the base of the PR and between ea7ec44 and 0265e71.

📒 Files selected for processing (3)
  • apps/site/src/components/Playground.tsx
  • apps/site/src/styles/site.css
  • apps/site/test/playground.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

Playground slider controls now store fractions directly and map them to configured track bounds. The card grid now constrains vertical overflow and painting. Tests cover slider endpoints and card-grid stylesheet properties.

Changes

Playground controls and card grid

Layer / File(s) Summary
Slider value mapping and bounds
apps/site/src/components/Playground.tsx, apps/site/test/playground.test.tsx
Slider handlers store fractions directly. PercentSlider scales the fraction and clamps it to the configured minimum and maximum. Tests drive each range input to both endpoints.
Card-grid containment
apps/site/src/styles/site.css, apps/site/test/playground.test.tsx
.card-grid constrains vertical overflow and painting while retaining horizontal scrolling. A stylesheet test checks horizontal scrolling and paint containment.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 0265e

No actionable merge-blocking issue is established. The changes address slider endpoints and card overflow; browser interaction behavior remains unverified by the supplied tests.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies both main changes: restoring slider endpoint access and preventing cards from intercepting slider clicks. It is specific and understandable.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@DoodleBears
DoodleBears merged commit 343b154 into main Sep 30, 2026
2 checks passed
@DoodleBears
DoodleBears deleted the fix/slider-range-and-card-clicking branch September 30, 2026 09:26
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