Skip to content

feat(examples): turn explainer slides with a tap on either half of the screen - #856

Merged
kylebarron merged 1 commit into
mainfrom
kyle/explainer-tap-nav
Nov 6, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/explainer-tap-nav

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

On a touchscreen, a tap on the right half of an explainer's stage now does what → does (finish the animation, or go to the next step), and a tap on the left half does what ← does. This applies to all three explainers: reprojection, MultiCOGLayer and antimeridian.

  • Taps on links and on the control bar keep their own meaning, and mouse clicks are unchanged.
  • A tap is one finger, lifted within 400 ms and 10 px of where it went down. Drags, pinches and long presses (such as a thumb resting on the screen) don't turn the slide.
  • 400 ms is under the existing 500 ms TOUCH_REVEAL_MS. A tap on the hidden control bar turns the slide, but it can't also press the button that appears under the finger.
  • Each README and in-app key list gets one line about it.

Taps are read from pointer events, not click, because of how iOS Safari handles taps. Its content change observer starts watching at touchstart (source). It counts opacity: 0 on an element, or on any of its four nearest ancestors, as hidden (source, which names YouTube's control bar as the case). When a tap makes clickable content visible, Safari treats it as a hover and sends no click. Here, the first tap after the control bar fades out brings the bar back, so with click that tap would only show the bar. Chrome, for its part, does fire click after a 700 ms press.

Closes #814

Testing

The tests sent real touch input (CDP Input.dispatchTouchEvent) to headed Chrome 157 with mobile emulation, in landscape (844 x 390) and portrait (390 x 844), against each explainer's dev server. All 25 checks pass in each explainer. They cover:

  • taps on each half, including 3 px either side of the center;
  • mouse clicks, drags, two-finger taps, long presses, slow taps and a quick double tap;
  • the control bar's buttons and checkbox, links in descriptions, and the side panel;
  • the tap that reveals the hidden bar.

Unit tests, typecheck, Biome and vite build pass for all three.

I haven't tried this on a physical phone. The iOS behavior above comes from reading WebKit's source, not from a device.

🤖 Written by Claude Code

…e screen

On a touchscreen, a tap on the right half of the stage now acts like →
(finish the animation, or go to the next step), and a tap on the left half
like ←. Taps on links and on the control bar keep their own meaning, and
mouse clicks are unchanged. The READMEs and the in-app key lists say so.

Taps are read from pointer events rather than click: iOS Safari treats a
tap that makes hidden content appear (here, the faded-out control bar) as a
hover and sends no click, so the first tap after the bar hid would only
reveal it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the feat label Nov 6, 2026
@kylebarron
kylebarron merged commit 32dbe12 into main Nov 6, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/explainer-tap-nav branch November 6, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On mobile devices, the explainers should handle prev/next slide with a tap/touch on the left/right side of the screen

1 participant