fix: polish mobile history lightbox swipe UX#41
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe PR enhances the image lightbox with time-based backdrop click suppression, integrates vertical swipe navigation with visual feedback styling, expands video lifecycle event handling (canplay, loadedmetadata, playing), and introduces autoplay resilience with retry logic. Comprehensive test coverage for swipe gestures and media player lifecycle events is added. Changes
Sequence DiagramsequenceDiagram
participant User
participant Lightbox as ImageLightbox
participant Swipe as useVerticalSwipeNavigation
participant Player as MediaPlayer
participant Hook as useMediaPlayer
User->>Swipe: Pointer Down
Swipe->>Swipe: Initialize drag tracking
User->>Swipe: Pointer Move (vertical)
Swipe->>Swipe: Calculate offset & direction
Swipe->>Swipe: Update overlayStyle & mediaStyle
Swipe->>Lightbox: Call onSwipeIntent()
Lightbox->>Lightbox: suppressBackdropClick (180ms)
User->>Swipe: Pointer Up
Swipe->>Swipe: Calculate velocity & distance
Swipe->>Lightbox: Trigger onNext or onPrevious
Lightbox->>Player: Render next/previous media
Player->>Hook: Video lifecycle events
Hook->>Hook: handleCanPlay (clear loading)
Hook->>Hook: handlePlaying (confirm playback)
Swipe->>Swipe: Snap animation or reset
Lightbox->>Lightbox: Update overlayStyle (final)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 353113f431
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <div | ||
| className="relative w-full h-full flex items-center justify-center p-4" | ||
| style={swipeMediaStyle} |
There was a problem hiding this comment.
Keep video backdrop close button clickable
In video lightbox mode, the full-screen swipe-motion container now sits above the absolute close button, so taps on the backdrop hit the motion layer instead of the button. This effectively breaks tap-to-close for videos when swipe navigation is enabled, forcing users to rely on alternate dismissal paths.
Useful? React with 👍 / 👎.
| clearScheduledWork(); | ||
| setTransition("none"); | ||
| setIsAnimating(false); |
There was a problem hiding this comment.
Preserve pending swipe navigation on new pointerdown
Calling clearScheduledWork() at the start of onPointerDown also clears the timeout that dispatches onSwipeUp/onSwipeDown after a committed swipe exit animation. If a user touches again during that 220ms window (for example, a quick second swipe/tap), the navigation callback is canceled and the swipe never advances, producing inconsistent or stuck navigation.
Useful? React with 👍 / 👎.
Summary
Testing
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests