Repository navigation
Improve touch device handling and remove Capacitor-specific sheet logic - #282
Conversation
- Remove auto-close sidebar behavior on navigation in Capacitor apps, allowing users to traverse drives without the sheet closing - Add useTouchDevice hook for detecting coarse pointer (touch) devices - Update PageTreeItem to disable hover tracking on touch devices and add "Add child page" option to context menu for mobile access - Update DriveList to always show action menu on touch devices instead of requiring hover https://claude.ai/code/session_0161mxvPnF8VSAZKVzkGCKi4
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughRemoved Capacitor-specific navigation auto-close from Layout; added a new client-side Changes
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/web/src/hooks/useTouchDevice.ts`:
- Around line 12-22: The subscribe function currently uses
mediaQueryList.addEventListener/removeEventListener which breaks in Safari <14;
update subscribe to feature-detect and use addEventListener/removeEventListener
when available and fall back to
mediaQueryList.addListener/mediaQueryList.removeListener otherwise (use a single
variable for the listener) so the same callback is registered/unregistered;
reference the TOUCH_QUERY constant and the mediaQueryList variable inside
subscribe to locate where to change the code.
Feature-detect addEventListener/removeEventListener on MediaQueryList and fall back to addListener/removeListener for older Safari versions. https://claude.ai/code/session_0161mxvPnF8VSAZKVzkGCKi4
Summary
This PR improves touch device detection and interaction handling across the application by introducing a new
useTouchDevicehook and removing Capacitor-specific sheet auto-close logic that was causing issues with sidebar navigation.Key Changes
New
useTouchDevicehook: Created a reliable touch device detection mechanism using media queries (pointer: coarse) instead of event-based detection. UsesuseSyncExternalStorefor proper SSR support.Removed Capacitor-specific sheet logic: Deleted the
useEffectinLayout.tsxthat was auto-closing sheets on navigation for Capacitor apps. This was causing sheets to close unexpectedly when navigating via sidebar items.Enhanced DriveList touch handling:
useTouchDevicehook to conditionally apply hover effectsonMouseEnter/onMouseLeavehandlers on touch devicesEnhanced PageTreeItem touch handling:
Cleanup: Removed unused imports (
usePathname,isCapacitorApp) fromLayout.tsxImplementation Details
The new
useTouchDevicehook uses the CSS media query(pointer: coarse)which is more reliable than checking for touch events, as it properly detects touch-capable devices including hybrid devices. The hook properly handles SSR withgetServerSnapshotreturningfalseand subscribes to media query changes for real-time updates.Touch-aware components now skip hover state updates on touch devices, improving UX by preventing hover effects from interfering with touch interactions while keeping action buttons visible for accessibility.
https://claude.ai/code/session_0161mxvPnF8VSAZKVzkGCKi4
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.