Skip to content

Commit ecc9884

Browse files
committed
fix(web): Cmd/Ctrl+click adds projects to the sidebar filter, like thread selection
1 parent 337c585 commit ecc9884

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ interface SidebarThreadPartitionInput {
359359
readonly clockKey: string;
360360
}
361361

362+
function isPlatformModKey(event: { readonly metaKey: boolean; readonly ctrlKey: boolean }) {
363+
return isMacPlatform(navigator.platform) ? event.metaKey : event.ctrlKey;
364+
}
365+
362366
function scrollSidebarToTop(content: HTMLElement | null) {
363367
content?.closest("[data-slot=scroll-area-viewport]")?.scrollTo({ top: 0 });
364368
}
@@ -1551,10 +1555,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
15511555

15521556
const handleThreadClick = (event: ReactMouseEvent, threadRef: ScopedThreadRef) => {
15531557
if (isSidebarNestedLinkClick(event.target)) return;
1554-
const isMac = isMacPlatform(navigator.platform);
1555-
const isModClick = isMac ? event.metaKey : event.ctrlKey;
15561558
const threadKey = scopedThreadKey(threadRef);
1557-
if (isModClick) {
1559+
if (isPlatformModKey(event)) {
15581560
event.preventDefault();
15591561
toggleThreadSelection(threadKey);
15601562
return;
@@ -2999,7 +3001,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
29993001
setProjectScopeKeys([]);
30003002
} else if (
30013003
eventDetails.event instanceof MouseEvent &&
3002-
eventDetails.event.shiftKey
3004+
isPlatformModKey(eventDetails.event)
30033005
) {
30043006
// Canceling skips Base UI's commit, which would freeze the search query, and its close.
30053007
eventDetails.cancel();
@@ -3075,13 +3077,18 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
30753077
toggleProjectGroupPin(project);
30763078
return;
30773079
}
3078-
if (event.ctrlKey || event.altKey || event.metaKey) return;
3079-
if (event.shiftKey && event.key === "Enter") {
3080+
if (
3081+
event.key === "Enter" &&
3082+
!event.shiftKey &&
3083+
!event.altKey &&
3084+
isPlatformModKey(event)
3085+
) {
30803086
if (!project) return;
30813087
event.preventDefault();
30823088
toggleProjectScopeKey(project.projectKey);
30833089
return;
30843090
}
3091+
if (event.ctrlKey || event.altKey || event.metaKey) return;
30853092
if (
30863093
event.key !== "ContextMenu" &&
30873094
!(event.shiftKey && event.key === "F10")

‎docs/user/thread-sidebar.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ On mobile, the thread list search also lists message matches and opens them at
228228
the matching message; on an iPad with a keyboard, `Cmd+K` opens the same
229229
palette.
230230

231+
On web and desktop, the project filter at the top of the sidebar narrows the thread
232+
list. Pick a project to show only its threads, or `Cmd/Ctrl+click` it (`Cmd/Ctrl+Enter`
233+
from the keyboard) to add or remove it and keep the menu open. On mobile, the filter
234+
holds one project.
235+
231236
Use **Settings → Keybindings** to find or customize shortcuts for searching files
232237
and copying a thread reference. A copied reference uses the thread's pull request
233238
link when available, otherwise a link to the thread, which opens it from anywhere

0 commit comments

Comments
 (0)