Repository navigation
Page the phone carousel one slide per swipe, including on iPhone Safari - #14
Merged
Merged
Conversation
On iPhone Safari a swipe off the post still skipped the first record: WebKit settles a flick on the snap point nearest its momentum and does not hold it at the next one, scroll-snap-stop or not, and the carousel's height now changes as a swipe crosses slides, which can set it snapping again. Once the component runs, the carousel no longer scrolls or snaps natively. A sideways drag follows the finger, and on release it moves one slide if it went a quarter of a slide or was flicked, and springs back otherwise. Vertical pans still scroll the page (touch-action: pan-y), and a sideways trackpad or wheel gesture moves one slide however long its momentum runs. Each swipe starts from the slide in view unless a move is still easing, so quick swipes chain and anything else that scrolls the carousel is followed. The CSS snapping stays as the fallback before the script loads. Checked in headless Chrome as a 375px touch phone: swipes from a slow quarter-slide drag to a 5000px/s flick each move exactly one slide, short slow drags spring back, consecutive swipes chain both ways, and a vertical swipe over the carousel scrolls the page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On iPhone Safari, a swipe off the homepage's post slide still skipped the first record, even after #11. The deployed CSS has
scroll-snap-stop: always, but WebKit doesn't hold a flick at the next slide: it settles on the snap point nearest the end of the fling's momentum. Since #10, the carousel's height also changes as a swipe crosses from one slide to the next, which can make Safari snap again partway through.The component now pages the carousel itself on phones (≤700px). Once it runs, the carousel stops scrolling and snapping natively (
.space[data-paged]):touch-action: pan-y).The height-fitting from #10 is untouched; it still follows the scroll position.
Testing. I couldn't test on WebKit: the iOS Simulator needs a full Xcode install, which this Mac doesn't have. Instead I drove headless Chrome over the DevTools protocol as a 375px touch phone:
Input.synthesizeScrollGesturetouch flings from a slow quarter-slide drag up to 5000px/s each moved exactly one slide.pnpm --dir documentation typecheck,pnpm --dir documentation test(16 of 16) andpnpm docs:buildpass. Please check it on an iPhone before merging.🤖 Generated with Claude Code