Skip to content

fix(studio): support drag on FlatSlider, not just click-to-set#2186

Open
vanceingalls wants to merge 1 commit into
studio-flat-12-slider-hit-areafrom
studio-flat-13-slider-drag
Open

fix(studio): support drag on FlatSlider, not just click-to-set#2186
vanceingalls wants to merge 1 commit into
studio-flat-12-slider-hit-areafrom
studio-flat-13-slider-drag

Conversation

@vanceingalls

@vanceingalls vanceingalls commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What

Thirteenth PR in the flat inspector stack (see #2120 for the foundation and full stack list). Adds real drag support to FlatSlider — dragging the track/knob now moves the value continuously with the cursor, matching how a native <input type="range"> behaves.

Stack: #2120 → ... → #2142#2186 (this).

Why

Reported directly after using the redesigned inspector live — only onPointerDown was ever wired on the slider's track, so a click set the value once but dragging did nothing further; the value stayed pinned to wherever the mouse first went down.

How

  • Added onPointerMove/onPointerUp alongside the existing onPointerDown, using the standard Pointer Capture API: setPointerCapture on pointerdown so the element keeps receiving move events even if the cursor leaves its bounds mid-drag, onPointerMove recomputes and commits the value from the current clientX while capture is held, and onPointerUp releases capture.
  • Confirmed this is genuinely missing (not a legacy-panel bug too) — the legacy SliderControl uses a native <input type="range">, which gets drag for free from the browser; FlatSlider is a custom-drawn track/knob div with no such built-in behavior, so this needed explicit wiring.

Test plan

  • New tests drive a full pointerdown→pointermove→pointermove→pointerup sequence and assert the committed value follows each intermediate position, plus a test confirming a stray pointermove after pointerup (capture released) is correctly ignored.
  • Verified live with real, trusted mouse input (not synthetic DOM events — Chromium silently no-ops setPointerCapture for untrusted/script-dispatched pointer events, which is worth knowing if this needs re-testing later): drove an actual mouse-down + mouse-move sequence via CDP-level input and confirmed the slider's value tracked the drag's live position, not just the initial click.
  • Full monorepo suite green (1584 tests, 0 failures); oxlint/oxfmt/fallow clean.
  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (not applicable — internal Studio UI behind an off-by-default flag)

vanceingalls commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed as part of the 15-PR edit-panel redesign stack. Full stack review posted on #2120. No blockers on this PR. — Miga

Only onPointerDown was wired, so dragging the knob/track only ever
committed the initial click position — nothing tracked the pointer
after that. Uses the Pointer Capture API (setPointerCapture on
pointerdown, onPointerMove while captured, release on pointerup) so
the value follows the cursor continuously during a drag, matching how
the legacy native <input type="range"> control behaves for free.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final current-head pass: ad36891. Reviewed the stack boundaries and current diff against the flat-inspector contracts; required checks have no failures/pending checks and no unresolved review threads remain. No new drift found; residual notes are non-blocking.

@vanceingalls vanceingalls force-pushed the studio-flat-12-slider-hit-area branch from a88b530 to fd1fb17 Compare July 11, 2026 01:34
@vanceingalls vanceingalls force-pushed the studio-flat-13-slider-drag branch from ad36891 to 102c503 Compare July 11, 2026 01:34

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseding earlier approval: the latest max-review pass found confirmed correctness issues in this flat-inspector stack (identity/selector-index state, hide-all write races, timing inference, slider pointer/keyboard/reset semantics, and duplicate React keys). Hold merge and require fixes plus re-review on the current stack head.

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.

3 participants