• About
  • Projects
  • CV
  • Email
  • LinkedIn
  • GitHub

A better comparison slider for mobile

A better comparison slider for mobile

Where 'mobile' turned out to be iOS Safari, with one fix that didn't regress on Android

Who
Personal ProjectMar 2026
Scope
Component designFrontend engineering
Tools
Visual Studio CodeVisual Studio CodeShadcnShadcnExcalidrawExcalidraw
Context

A useful desktop component that quietly fell apart on mobile

The comparison slider lets you scrub between two states of a design and see the difference directly.

The problems

Thumb obstruction and scroll interference, neither of which exists on desktop

Dragging the handle across the image puts your thumb directly over the area you're trying to evaluate. The comparison you're making is hidden by your own hand. A fundamental conflict between the control and the content.

A better comparison slider for mobile
Thumb covers the area you're trying to evaluate, with handle and content occupying the same space

The horizontal drag gesture competes with the vertical scroll of the page, and the result is shaky and unpredictable, feeling broken even when it technically isn't.

Your browser does not support the video tag.
Dragging horizontally fights the vertical scroll, with the page juddering behind the gesture

Neither exists on desktop, where a cursor is precise and weightless, while mobile surfaces a whole category of issues that don't exist at cursor scale.

A better comparison slider for mobile — before
A better comparison slider for mobile — after
Try it now if you're on a phone, or take my word for it if you're on desktop
The fix

Moving the handle out of the image, with one line of code to stop the scroll fight

Your thumb gets a dedicated zone, the full image stays visible, and the caption moves above the image so it's readable wherever the handle sits. Content above, control below, label up top. Each element has its own space.

A better comparison slider for mobile
The handle moves below the image, out of the content area
A better comparison slider for mobile
The caption moves above the image, always readable

Stopping the page from scrolling while dragging needs one explicit instruction: passive: false. Without it, the browser handles the touch event before your code can, and the page moves anyway.

comparison-slider-block.tsx
Calling preventDefault() on touch events to stop scroll during drag

The question during sketching was whether a detached handle would still feel connected to the image, and the answer was in the feedback. As long as the image responds in real time, the relationship is clear, and the handle doesn't need to sit on the image to feel like it controls it.

Same scene, very different company
A better comparison slider for mobile — before
A better comparison slider for mobile — after
Outcome

The slider now works on mobile, with the iOS Safari fix landing regression-free on Android

The thumb stops obscuring the comparison, and the page stops fighting the gesture. A developer pointed out post-launch that the issues were iOS Safari-specific, and the fix works on Android anyway, so a browser-specific improvement without a regression.

Share on LinkedIn

Other projects

Building a design system where the code leads and Figma follows

Design Engineering · Design Systems

Building a design system where the code leads and Figma follows

Building a practice tool that targets your weakness, not your strength

Product Design · AI Integration · Frontend Engineering

Building a practice tool that targets your weakness, not your strength

Building a product from scratch at an early-stage startup

Product Design · Design Systems · Design Engineering

Building a product from scratch at an early-stage startup

Component Lab: a visual workspace for shadcn

Design Engineering · Frontend Engineering · AI Integration

Component Lab: a visual workspace for shadcn

Designing my portfolio like a product

Design Engineering · Frontend Engineering

Designing my portfolio like a product

Reducing churn for a global subscription service

UX Research · Product Design · Strategy

Reducing churn for a global subscription service

Designing and animating my personal brand mark

Brand Design · Motion Design

Designing and animating my personal brand mark

Designing a smarter GenAI workflow for AI developers

Product Design · UX Research · AI Integration

Designing a smarter GenAI workflow for AI developers

Building a scalable design system for a global risk platform

Design Systems · Product Design

Building a scalable design system for a global risk platform

Optimising the digital shopping experience for a home improvement retailer

UX Research · Product Design

Optimising the digital shopping experience for a home improvement retailer

Validating demand for a low-cost learning device in India

UX Research · Strategy

Validating demand for a low-cost learning device in India

Cutting through the noise with short-form sales content

Content Strategy

Cutting through the noise with short-form sales content

Understanding a diverse diaspora audience

UX Research · Strategy

Understanding a diverse diaspora audience

Building a brand and site a solo founder can run himself

Brand Design · Design Engineering

Building a brand and site a solo founder can run himself

Building a design system where the code leads and Figma follows

Design Engineering · Design Systems

Building a design system where the code leads and Figma follows

Building a practice tool that targets your weakness, not your strength

Product Design · AI Integration · Frontend Engineering

Building a practice tool that targets your weakness, not your strength

Building a product from scratch at an early-stage startup

Product Design · Design Systems · Design Engineering

Building a product from scratch at an early-stage startup

Component Lab: a visual workspace for shadcn

Design Engineering · Frontend Engineering · AI Integration

Component Lab: a visual workspace for shadcn

Designing my portfolio like a product

Design Engineering · Frontend Engineering

Designing my portfolio like a product

Reducing churn for a global subscription service

UX Research · Product Design · Strategy

Reducing churn for a global subscription service

Designing and animating my personal brand mark

Brand Design · Motion Design

Designing and animating my personal brand mark

Designing a smarter GenAI workflow for AI developers

Product Design · UX Research · AI Integration

Designing a smarter GenAI workflow for AI developers

Building a scalable design system for a global risk platform

Design Systems · Product Design

Building a scalable design system for a global risk platform

Optimising the digital shopping experience for a home improvement retailer

UX Research · Product Design

Optimising the digital shopping experience for a home improvement retailer

Validating demand for a low-cost learning device in India

UX Research · Strategy

Validating demand for a low-cost learning device in India

Cutting through the noise with short-form sales content

Content Strategy

Cutting through the noise with short-form sales content

Understanding a diverse diaspora audience

UX Research · Strategy

Understanding a diverse diaspora audience

Building a brand and site a solo founder can run himself

Brand Design · Design Engineering

Building a brand and site a solo founder can run himself