Repository navigation
fix: sliders that could not reach their own ends, and cards that ate slider clicks - #9
Conversation
…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.
|
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 configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughPlayground 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. ChangesPlayground controls and card grid
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation 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.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Why
Two reports, both real, both found by writing the failing test first:
Cause
1a.
PercentSliderclamped every slider at the middle of its own track.value={Math.round(clamp(fraction, 0, 1) * 100)}pinned the thumb at track100regardless 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 dotsoverlap 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.
PercentSlideralready convertsthe track value back to a 0…1 fraction before
onChange; softness, grow, floor, gap x andgap 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 was0.005. This is the sameraw-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.
ChasingandMorphingwere clickable; the cards past them were not.overflow-x: autoscrolls andclips 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,Morphingandoffrendered, looked selectable, and swallowed nothing: theslider underneath took every click.
contain: paintstops the escape.Special things to note
onChangecall sites, one CSS declaration.Site-only. Review focus is
PercentSlider— the unit contract between it and its callers.a test drives every slider to its declared
minandmaxand fails if it stops short. Thecard fix is asserted against the stylesheet, because jsdom loads no CSS and
getComputedStylereturned empty for every property — so the regression test checks thatcontain: paintis still declared. That is weaker than measuring, and the measurement thatfound the bug (
document.elementFromPointinside the overlap, in a real browser) cannot runin jsdom. The gap is named rather than papered over.
that rather than quietly closing the report.
staggerandsoftnessdo reach the CSSrenderer:
field.tssets--botui-seedfrom the spread and the stylesheet delays each cellby it, so the per-dot delay is real. What makes
chasinglook unsmooth is that it is auniform 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.
🤖 Generated with Claude Code
Summary by CodeRabbit