fix(web): hide mobile sidebar after thread selection or creation#1293
fix(web): hide mobile sidebar after thread selection or creation#1293murataslan1 wants to merge 2 commits intopingdotgg:mainfrom
Conversation
On narrow viewports, the sidebar stayed open after selecting or creating a thread, obscuring the thread content. Now the sidebar closes automatically on mobile when: - Clicking an existing thread - Pressing Enter/Space on a thread row - Clicking the "New Thread" button Desktop behavior is unchanged. Fixes pingdotgg#1258
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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.
Pull request overview
This PR fixes a mobile UX issue in the web app where the off-canvas thread sidebar remained open after selecting or creating a thread, obscuring the main thread content on narrow viewports.
Changes:
- Close the mobile sidebar on plain thread selection (mouse click).
- Close the mobile sidebar on keyboard activation of a thread row (Enter/Space).
- Close the mobile sidebar when clicking “New Thread”.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (isMobile) { | ||
| setOpenMobile(false); | ||
| } |
There was a problem hiding this comment.
The nearby comment describing the plain-click behavior doesn’t mention that we now also close the mobile sidebar. Please update the comment so it remains accurate.
| } | ||
| setSelectionAnchor(thread.id); | ||
| if (isMobile) { | ||
| setOpenMobile(false); | ||
| } |
There was a problem hiding this comment.
This Enter/Space handler duplicates the same “activate thread” steps as the click path (clear selection, set anchor, close mobile sidebar, navigate). Consider extracting a shared helper and calling it from both handlers to prevent the two paths drifting over time.
…bile-sidebar-auto-close Co-authored-by: codex <codex@users.noreply.github.com> # Conflicts: # apps/web/src/components/Sidebar.tsx
ApprovabilityVerdict: Approved Simple mobile UX fix that closes the sidebar after thread selection or creation. Changes are self-contained to mobile behavior only, using existing useSidebar hook patterns. Unresolved comments are code style suggestions, not bugs. You can customize Macroscope's approvability policy. Learn more. |
Summary
On narrow viewports, the sidebar stayed open after selecting or creating a thread, obscuring the thread content.
Fix
Close the mobile sidebar automatically when:
Desktop behavior is unchanged — uses
isMobilefromuseSidebar()to gate the behavior.Test plan
Fixes #1258
Note
Hide mobile sidebar after thread selection or creation
Calls
setOpenMobile(false)in thenavigateToThread,handleThreadClick, andcreateThreadForProjectMembercallbacks in Sidebar.tsx whenisMobileis true. This ensures the sidebar dismisses itself on mobile after the user selects or creates a thread.Macroscope summarized c27f9d0.
Note
Low Risk
Low risk UI-only behavior change gated behind
isMobile; main risk is unintended sidebar closing on narrow viewports ifisMobiledetection is off.Overview
Fixes mobile UX where the sidebar remained open after choosing or creating a thread.
Sidebar.tsxnow usesuseSidebar()to automatically callsetOpenMobile(false)(only whenisMobile) when navigating to a thread via click/keyboard activation and when creating a new thread, leaving desktop behavior unchanged.Reviewed by Cursor Bugbot for commit c27f9d0. Bugbot is set up for automated code reviews on this repo. Configure here.