Skip to content

feat(snapshots): Add click-to-snap interaction on wipe slider#110102

Merged
NicoHinderling merged 2 commits intomasterfrom
NicoHinderling/feat/click-to-snap-wipe-slider
Mar 6, 2026
Merged

feat(snapshots): Add click-to-snap interaction on wipe slider#110102
NicoHinderling merged 2 commits intomasterfrom
NicoHinderling/feat/click-to-snap-wipe-slider

Conversation

@NicoHinderling
Copy link
Contributor

@NicoHinderling NicoHinderling commented Mar 6, 2026

try it: https://sentry-1p29scb2a.sentry.dev//issues/5460107969/?project=6301746

Add click-anywhere-to-snap interaction to the ContentSliderDiff wipe slider component. Previously users had to precisely grab the narrow 12px drag handle to reposition the divider. Now clicking anywhere on the image comparison area snaps the handle to the cursor position and seamlessly continues into drag mode.

Changes:

  • contentSliderDiff/index.tsx — Replace Fragment wrapper with a positioned container that captures mousedown events, calculates the click position relative to the container, snaps the slider via setSize, then initiates the drag. Double-click reset on the handle is preserved. Right/middle clicks are ignored.
  • useResizableDrawer.tsx — Synchronize sizeRef.current immediately in updateSize before the async setSize call. This prevents the drag handle from jumping back to the stale position on the first mousemove after a programmatic snap.

Click anywhere on the image comparison area to snap the slider handle
to the cursor position and begin dragging. Previously users had to
precisely grab the narrow 12px drag handle.

Also fix a race condition in useResizableDrawer where sizeRef.current
lagged behind programmatic setSize calls, causing the handle to jump
back momentarily on first mousemove.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 6, 2026
@NicoHinderling NicoHinderling marked this pull request as ready for review March 6, 2026 18:16
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

🔥 Nice! This is looking lovely

@NicoHinderling NicoHinderling merged commit 1908286 into master Mar 6, 2026
65 checks passed
@NicoHinderling NicoHinderling deleted the NicoHinderling/feat/click-to-snap-wipe-slider branch March 6, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants