diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index d863e285a80e7..7327521ecf527 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -360,6 +360,10 @@ interface SidebarThreadPartitionInput { readonly clockKey: string; } +function isPlatformModKey(event: { readonly metaKey: boolean; readonly ctrlKey: boolean }) { + return isMacPlatform(navigator.platform) ? event.metaKey : event.ctrlKey; +} + function scrollSidebarToTop(content: HTMLElement | null) { content?.closest("[data-slot=scroll-area-viewport]")?.scrollTo({ top: 0 }); } @@ -1556,10 +1560,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve const handleThreadClick = (event: ReactMouseEvent, threadRef: ScopedThreadRef) => { if (isSidebarNestedLinkClick(event.target)) return; - const isMac = isMacPlatform(navigator.platform); - const isModClick = isMac ? event.metaKey : event.ctrlKey; const threadKey = scopedThreadKey(threadRef); - if (isModClick) { + if (isPlatformModKey(event)) { event.preventDefault(); toggleThreadSelection(threadKey); return; @@ -3019,7 +3021,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve setProjectScopeKeys([]); } else if ( eventDetails.event instanceof MouseEvent && - eventDetails.event.shiftKey + isPlatformModKey(eventDetails.event) ) { // Canceling skips Base UI's commit, which would freeze the search query, and its close. eventDetails.cancel(); @@ -3095,13 +3097,18 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve toggleProjectGroupPin(project); return; } - if (event.ctrlKey || event.altKey || event.metaKey) return; - if (event.shiftKey && event.key === "Enter") { + if ( + event.key === "Enter" && + !event.shiftKey && + !event.altKey && + isPlatformModKey(event) + ) { if (!project) return; event.preventDefault(); toggleProjectScopeKey(project.projectKey); return; } + if (event.ctrlKey || event.altKey || event.metaKey) return; if ( event.key !== "ContextMenu" && !(event.shiftKey && event.key === "F10") diff --git a/docs/user/thread-sidebar.md b/docs/user/thread-sidebar.md index f5ea773067e89..974182be944e5 100644 --- a/docs/user/thread-sidebar.md +++ b/docs/user/thread-sidebar.md @@ -232,6 +232,11 @@ On mobile, the thread list search also lists message matches and opens them at the matching message; on an iPad with a keyboard, `Cmd+K` opens the same palette. +On web and desktop, the project filter at the top of the sidebar narrows the thread +list. Pick a project to show only its threads, or `Cmd/Ctrl+click` it (`Cmd/Ctrl+Enter` +from the keyboard) to add or remove it and keep the menu open. On mobile, the filter +holds one project. + Use **Settings → Keybindings** to find or customize shortcuts for searching files and copying a thread reference. A copied reference uses the thread's pull request link when available, otherwise a link to the thread, which opens it from anywhere