• About
  • Projects
  • Contact
  • LinkedIn
  • GitHub

A better comparison slider for mobile

The comparison slider is one of the more useful components on this site. On mobile, it has two problems that quietly undermine the whole point of it.

A better comparison slider for mobile
Role
Designer + Developer
Client
Personal Project
Date
Mar 2026
Tools
Visual Studio CodeVisual Studio CodeShadcnShadcnExcalidrawExcalidraw

TL;DR

Where I started.The comparison slider lets you scrub between two states of a design and see the difference directly. On desktop it works well. On mobile, two interaction problems make it almost useless.

What I did. Moved the handle out of the content area, fixed the touch event handling, and rebuilt the component for the device people are actually reading this on.

What changed. The slider does what it's supposed to do. The thumb stops obscuring the comparison. The page stops fighting the gesture.

The problems

Desktop hides what mobile can't.

The first problem is thumb obstruction. When you drag the handle across the image, your thumb sits 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. The handle and the content occupy the same space.

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

Your browser does not support the video tag.
Dragging the handle horizontally conflicts with vertical page scroll, causing the page to judder behind the gesture.

Neither exists on desktop, where a cursor is precise and weightless. 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
If you're reading this on your phone, try it now. If you're on desktop, take my word for it.
The fix

Separating the control from the content.

Moving the handle below the image removes the obstruction entirely. Your thumb operates in a dedicated zone, the full image stays visible, and the caption moves above so it stays 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. The answer was in the feedback. As long as the image responds in real time, the relationship is clear. 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
What I took from it

Being both designer and user means the feedback loop is instant.

No test cycle to confirm what's already obvious. The catch is the inverse: easy to assume what works on your device works everywhere. A developer pointed out post-launch that the issues were iOS Safari-specific. The fix works on Android anyway, so a browser-specific improvement without a regression. Useful reminder that "mobile" isn't one thing, and that being your own user only takes you as far as your own device.

Share on LinkedIn

Other projects

Component Lab: a visual workspace for shadcn
Component Lab: a visual workspace for shadcn

Browse, edit, or build from scratch. Four weeks of solo design and build, with AI as engineering partner.

Building a product from scratch at an early-stage startup
Building a product from scratch at an early-stage startup

Eleven months at a remote AI startup, first designer in. From no brand or UI to a shipped product with a successful pilot demo.

Designing my portfolio like a product
Designing my portfolio like a product

A new portfolio site, designed and built with the same care I'd give any other product brief.

Reducing churn for a global subscription service
Reducing churn for a global subscription service

10 weeks on a churn problem. Three concept directions, 15 international interviews on the most testable one, and a printer of our own to walk the customer journey end to end.

Designing a smarter GenAI workflow for AI developers
Designing a smarter GenAI workflow for AI developers

Three iterations, 32 international users, and a product that stopped being a separately-named add-on along the way.

Building a scalable design system for a global risk platform
Building a scalable design system for a global risk platform

Four weeks to audit, build, and document. Dataviz built in as a first-class subsystem, not an afterthought.

Optimising the digital shopping experience for a home improvement retailer
Optimising the digital shopping experience for a home improvement retailer

A 3-week diagnostic across paint, kitchen, and timber. 153 ranked usability issues, four strategic questions, and Figma design variants for each.

Validating demand for a low-cost learning device in India
Validating demand for a low-cost learning device in India

A fake brand, real ads, and two weeks of live testing. What people want and what they'll pay for aren't the same number.

Cutting through the noise with short-form sales content
Cutting through the noise with short-form sales content

Eleven short videos to dispel myths about a managed services product, built to travel across markets, languages, and attention spans.

Understanding a diverse diaspora audience
Understanding a diverse diaspora audience

Ten interviews and four personas to help a community organisation see its audience more honestly.

Building a brand and site a solo founder can run himself
Building a brand and site a solo founder can run himself

A brand, site, and CMS for a solo legal advisor, built from a personal referral in under a week.

Component Lab: a visual workspace for shadcn
Component Lab: a visual workspace for shadcn

Browse, edit, or build from scratch. Four weeks of solo design and build, with AI as engineering partner.

Building a product from scratch at an early-stage startup
Building a product from scratch at an early-stage startup

Eleven months at a remote AI startup, first designer in. From no brand or UI to a shipped product with a successful pilot demo.

Designing my portfolio like a product
Designing my portfolio like a product

A new portfolio site, designed and built with the same care I'd give any other product brief.

Reducing churn for a global subscription service
Reducing churn for a global subscription service

10 weeks on a churn problem. Three concept directions, 15 international interviews on the most testable one, and a printer of our own to walk the customer journey end to end.

Designing a smarter GenAI workflow for AI developers
Designing a smarter GenAI workflow for AI developers

Three iterations, 32 international users, and a product that stopped being a separately-named add-on along the way.

Building a scalable design system for a global risk platform
Building a scalable design system for a global risk platform

Four weeks to audit, build, and document. Dataviz built in as a first-class subsystem, not an afterthought.

Optimising the digital shopping experience for a home improvement retailer
Optimising the digital shopping experience for a home improvement retailer

A 3-week diagnostic across paint, kitchen, and timber. 153 ranked usability issues, four strategic questions, and Figma design variants for each.

Validating demand for a low-cost learning device in India
Validating demand for a low-cost learning device in India

A fake brand, real ads, and two weeks of live testing. What people want and what they'll pay for aren't the same number.

Cutting through the noise with short-form sales content
Cutting through the noise with short-form sales content

Eleven short videos to dispel myths about a managed services product, built to travel across markets, languages, and attention spans.

Understanding a diverse diaspora audience
Understanding a diverse diaspora audience

Ten interviews and four personas to help a community organisation see its audience more honestly.

Building a brand and site a solo founder can run himself
Building a brand and site a solo founder can run himself

A brand, site, and CMS for a solo legal advisor, built from a personal referral in under a week.