Skip to content

feat: add mobile swipe gestures for sidebar navigation#1679

Open
42tg wants to merge 1 commit intopingdotgg:mainfrom
42tg:feat/mobile-swipe-gestures
Open

feat: add mobile swipe gestures for sidebar navigation#1679
42tg wants to merge 1 commit intopingdotgg:mainfrom
42tg:feat/mobile-swipe-gestures

Conversation

@42tg
Copy link
Copy Markdown

@42tg 42tg commented Apr 2, 2026

Summary

  • Add touch swipe gesture support for opening/closing the sidebar on mobile devices
  • Pure logic module (sidebar.swipe.logic.ts) with full test coverage
  • Integrated into the existing sidebar component with configurable thresholds

Test plan

  • On a mobile device or touch simulator, swipe right from the left edge to open sidebar
  • Swipe left on the sidebar to close it
  • Verify swipe gestures don't interfere with normal scrolling
  • Run bun run test to verify swipe logic unit tests pass

Note

Medium Risk
Adds new touch gesture handling that changes mobile navigation and sheet interaction; risk is mainly UX regressions (scroll vs swipe conflicts, unexpected auto-close) rather than data/security impact.

Overview
Adds mobile touch gestures for the sidebar: swipe-from-left-edge on SidebarInset opens the mobile sidebar with a live edge "peek" indicator, and swiping the open mobile sheet dismisses it via a new SwipeToDismiss wrapper.

Introduces a new pure gesture state module (sidebar.swipe.logic.ts) with configurable thresholds and scroll-cancellation rules, plus a dedicated Vitest suite to lock behavior. Also updates Sidebar.tsx to auto-close the mobile sidebar when navigating to a thread (click or programmatic navigation).

Written by Cursor Bugbot for commit 96e1915. This will update automatically on new commits. Configure here.

Note

Add mobile swipe gestures to open and dismiss the sidebar

  • Adds a SwipeToDismiss component in sidebar.tsx that wraps mobile sidebar sheet content; swiping horizontally past SWIPE_THRESHOLD in the closing direction triggers setOpenMobile(false).
  • Adds swipe-from-left-edge detection to SidebarInset: touches starting within 80px of the left edge can open the sidebar, with a visual edge peek indicator that grows as the user drags.
  • Introduces pure gesture state functions resolveSwipeGestureState and resolvePullGestureState with threshold-based lock-in and vertical-scroll cancellation logic, covered by a dedicated test suite.
  • Closes the mobile sidebar on thread click or programmatic navigation in Sidebar.tsx.

Macroscope summarized 96e1915.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 2, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4bc5d92f-7720-4697-be16-208c369d6e88

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@42tg 42tg force-pushed the feat/mobile-swipe-gestures branch from e28e042 to ba9aa5c Compare April 2, 2026 10:40
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 2, 2026

Approvability

Verdict: Needs human review

This PR introduces a new mobile feature: swipe gestures to open/close the sidebar. While the implementation is well-structured with separated logic and unit tests, it adds new user-facing touch interaction behavior that warrants human review before merging.

You can customize Macroscope's approvability policy. Learn more.

@42tg 42tg force-pushed the feat/mobile-swipe-gestures branch from ba9aa5c to a865914 Compare April 2, 2026 10:56
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

return "pulling";
}
return "idle";
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull gesture exports unused in production code

Low Severity

resolvePullGestureState, PULL_THRESHOLD, and PullGestureState are exported but never imported by any production code — only the test file references them. The PullToReveal component mentioned in the PR description does not exist in the codebase, making this dead code that adds maintenance surface with no consumers.

Fix in Cursor Fix in Web

- Add sidebar.swipe.logic.ts with pure state machine for horizontal
  swipe and vertical pull-down gesture detection
- Wrap mobile sidebar sheet with SwipeToDismiss for drag-to-close
- Detect edge swipes in SidebarInset to open sidebar
- Add PullToReveal component for pull-down gesture feedback
- Auto-close mobile sidebar on thread selection
- 17 new tests for gesture logic
@42tg 42tg force-pushed the feat/mobile-swipe-gestures branch from a865914 to 96e1915 Compare April 2, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant