:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(signals): restore native command-click on inbox reports (#99341)
Chris Volzerb74c7f97ea6d
diff --git a/docs/internal/inbox-report-selection.md b/docs/internal/inbox-report-selection.mdindex 9e636e5a98ef..15c34629e252 100644--- a/docs/internal/inbox-report-selection.md+++ b/docs/internal/inbox-report-selection.md@@ -3,7 +3,8 @@Report cards on the self-driving inbox Reports page do not show selection checkboxes, including on hover or when selected.Selected cards keep their accent outline.-Use Cmd+click on macOS or Ctrl+click to select or deselect a report.+Cmd+click on macOS and Ctrl+click keep the browser's standard link behavior instead of changing the selection.+This also applies when reports are selected or a bulk action runs.Use Shift+click to select a range of reports.Press and hold also selects a report.Once a selection exists, a plain click selects or deselects a report instead of opening it.diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsxindex 902ca42137b0..7cb440ae0f16 100644--- a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx@@ -84,15 +84,27 @@ describe('ReportCard', () => {expect(logic.values.selectedReportIds).toEqual([])})- it('selects on cmd-click instead of opening the report', () => {- fireEvent.click(cardLink(), { metaKey: true })+ test.each([+ ['cmd-click', { metaKey: true }],+ ['ctrl-click', { ctrlKey: true }],+ ['cmd-shift-click', { metaKey: true, shiftKey: true }],+ ['ctrl-shift-click', { ctrlKey: true, shiftKey: true }],+ ])('leaves %s to the browser with or without a selection', (_name, modifiers) => {+ expect(fireEvent.click(cardLink(), modifiers)).toBe(true)+ expect(openedReport()).toBe(false)+ expect(logic.values.selectedReportIds).toEqual([])+ expect(lastSelectionEntry()).toBeUndefined()+ act(() => logic.actions.setSelectedReportIds(['r-1']))++ expect(fireEvent.click(cardLink(), modifiers)).toBe(true)expect(openedReport()).toBe(false)expect(logic.values.selectedReportIds).toEqual(['r-1'])+ expect(lastSelectionEntry()).toBeUndefined()})it('toggles on a plain click once the list is in selection mode', () => {- fireEvent.click(cardLink(), { metaKey: true })+ act(() => logic.actions.setSelectedReportIds(['r-1']))fireEvent.click(cardLink())expect(openedReport()).toBe(false)@@ -120,17 +132,14 @@ describe('ReportCard', () => {expect(logic.values.selectedReportIds).toEqual([])})- test.each([- ['cmd-click', { metaKey: true }, 'meta_click'],- ['shift-click', { shiftKey: true }, 'shift_click'],- ])('records the entry method when a %s starts the selection', (_name, modifiers, entryMethod) => {+ it('records the entry method when a shift-click starts the selection', () => {// The rendered order, which a shift-range measures itself against.logic.actions.setVisibleReportIds(['r-1'])- fireEvent.click(cardLink(), modifiers)+ fireEvent.click(cardLink(), { shiftKey: true })expect(logic.values.selectedReportIds).toEqual(['r-1'])- expect(lastSelectionEntry()).toMatchObject({ entry_method: entryMethod })+ expect(lastSelectionEntry()).toMatchObject({ entry_method: 'shift_click' })})it('leaves a cmd-click on the nested scout link to the browser', () => {@@ -158,7 +167,7 @@ describe('ReportCard', () => {fireEvent.mouseEnter(cardLink())expect(screen.queryByRole('checkbox')).not.toBeInTheDocument()- fireEvent.click(cardLink(), { metaKey: true })+ act(() => logic.actions.setSelectedReportIds(['r-1']))expect(screen.queryByRole('checkbox')).not.toBeInTheDocument()expect(logic.values.selectedReportIds).toEqual(['r-1'])@@ -180,7 +189,9 @@ describe('ReportCard', () => {logic.actions.bulkDismiss({ reason: 'other', note: '', correctedRepository: null })})- fireEvent.click(cardLink(), { metaKey: true })+ expect(fireEvent.click(cardLink(), { metaKey: true })).toBe(true)+ expect(fireEvent.click(cardLink(), { ctrlKey: true })).toBe(true)+ expect(fireEvent.click(cardLink())).toBe(false)expect(logic.values.selectedReportIds).toEqual(['r-1'])setState.mockRestore()})diff --git a/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx b/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsxindex 3a1ccf44ada3..d774c5d79ef4 100644--- a/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx@@ -136,7 +136,7 @@ function ReportContextMenuItems({const hasOpenPr = hasOpenImplementationPr(report)const { isSelected, toggle: toggleSelection } = useReportCardSelection(report.id, true)- // The row's own affordances (hold, Cmd-click, checkbox) are easy to miss, so the menu names+ // The row's own selection gestures (hold, Shift-click) are easy to miss, so the menu names// the feature outright.const selectItem = (<ContextMenuItem asChild>diff --git a/products/signals/frontend/inbox/components/cards/useReportCardSelection.ts b/products/signals/frontend/inbox/components/cards/useReportCardSelection.tsindex c5cd46ff2742..e8d27ae0764a 100644--- a/products/signals/frontend/inbox/components/cards/useReportCardSelection.ts+++ b/products/signals/frontend/inbox/components/cards/useReportCardSelection.ts@@ -12,7 +12,7 @@ import {export interface ReportCardSelection {isSelected: boolean- /** True once anything is selected: every card then toggles on click. */+ /** True once anything is selected: every card then toggles on a plain click. */selectionMode: boolean/** Set while a hold is running, so the card suppresses text selection under the finger. */isHolding: boolean@@ -22,8 +22,7 @@ export interface ReportCardSelection {toggle: (method: InboxSelectionEntryMethod) => void/*** Handlers for the wrapper around the card body. The click is handled in the capture phase,- * because the body is a `Link` that answers a Cmd-click itself and never calls a handler- * passed to it.+ * so selection can stop navigation before the body's `Link` handles the click.*/cardHandlers: {onClickCapture: (event: MouseEvent) => void@@ -36,7 +35,7 @@ export interface ReportCardSelection {}/**- * Multi-select gestures for one report row: press and hold, Cmd / Ctrl-click, shift-range, and the+ * Multi-select gestures for one report row: press and hold, shift-range, and the* gutter checkbox. The selection itself lives in `inboxBulkActionsLogic`; this hook only turns* pointer events into its actions, and it does nothing at all on a row the list marks unselectable.*/@@ -79,7 +78,7 @@ export function useReportCardSelection(reportId: string, enabled: boolean): Repo// A touch that never produces a click would otherwise leave the suppression armed for// the next press.suppressClickRef.current = false- // Only the primary button holds; a modifier click is already a selection of its own.+ // Only the primary button holds; modified clicks have separate actions.if (!enabled ||selectionDisabled ||@@ -119,7 +118,7 @@ export function useReportCardSelection(reportId: string, enabled: boolean): Repoconst onClick = useCallback((event: MouseEvent): void => {- if (!enabled) {+ if (!enabled || event.metaKey || event.ctrlKey || event.button !== 0) {return}if (suppressClickRef.current) {@@ -137,13 +136,8 @@ export function useReportCardSelection(reportId: string, enabled: boolean): Repo}return}- // A modifier click on a link nested in the row, such as the scout's name, belongs to- // that link: Cmd or Ctrl opens it in a new tab. The link cannot keep the click for- // itself here, because a capture handler runs before the target's own handlers.- if (- (event.shiftKey || event.metaKey || event.ctrlKey) &&- isNestedControlClick(event.target, event.currentTarget)- ) {+ // A shift-click on a nested link belongs to that link, not the row's selection.+ if (event.shiftKey && isNestedControlClick(event.target, event.currentTarget)) {return}const intent = resolveReportCardClickIntent(event, hasSelection)@@ -162,9 +156,9 @@ export function useReportCardSelection(reportId: string, enabled: boolean): ReposelectRange(reportId)return}- toggle('meta_click')+ toggleReportSelection(reportId)},- [enabled, hasSelection, reportId, selectRange, selectionDisabled, toggle]+ [enabled, hasSelection, reportId, selectRange, selectionDisabled, toggleReportSelection])return {diff --git a/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.tsx b/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.tsxindex d70794cbf6d6..89e9b2411e66 100644--- a/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.tsx+++ b/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.tsx@@ -30,7 +30,7 @@ export function InboxBulkSelectionBar({ reports }: { reports: SignalReport[] }):<div className="flex items-center justify-between gap-3 flex-wrap rounded border border-accent bg-accent-highlight-secondary px-3 py-2"><div className="flex items-center gap-2 min-w-0"><span className="font-medium text-sm shrink-0">{selectedCount} selected</span>- <span className="text-xs text-muted">Shift-click range · ⌘-click toggle · Esc to clear</span>+ <span className="text-xs text-muted">Shift-click range · Click to toggle · Esc to clear</span></div><div className="flex items-center gap-2 flex-wrap">diff --git a/products/signals/frontend/inbox/utils/reportSelection.test.ts b/products/signals/frontend/inbox/utils/reportSelection.test.tsindex 85ba0171f23a..a5999ba66937 100644--- a/products/signals/frontend/inbox/utils/reportSelection.test.ts+++ b/products/signals/frontend/inbox/utils/reportSelection.test.ts@@ -6,10 +6,13 @@ describe('resolveReportCardClickIntent', () => {test.each([['plain click with nothing selected opens the report', plain, false, 'open'],['plain click in selection mode toggles instead of opening', plain, true, 'toggle'],- ['cmd-click toggles from an empty selection', { ...plain, metaKey: true }, false, 'toggle'],- ['ctrl-click toggles from an empty selection', { ...plain, ctrlKey: true }, false, 'toggle'],+ ['cmd-click opens from an empty selection', { ...plain, metaKey: true }, false, 'open'],+ ['ctrl-click opens from an empty selection', { ...plain, ctrlKey: true }, false, 'open'],+ ['cmd-click opens in selection mode', { ...plain, metaKey: true }, true, 'open'],+ ['ctrl-click opens in selection mode', { ...plain, ctrlKey: true }, true, 'open'],['shift-click ranges', { ...plain, shiftKey: true }, true, 'range'],- ['shift wins over cmd', { shiftKey: true, metaKey: true, ctrlKey: false }, true, 'range'],+ ['cmd wins over shift', { shiftKey: true, metaKey: true, ctrlKey: false }, true, 'open'],+ ['ctrl wins over shift', { shiftKey: true, metaKey: false, ctrlKey: true }, true, 'open'],])('%s', (_name, modifiers, hasSelection, expected) => {expect(resolveReportCardClickIntent(modifiers, hasSelection)).toBe(expected)})diff --git a/products/signals/frontend/inbox/utils/reportSelection.ts b/products/signals/frontend/inbox/utils/reportSelection.tsindex a81ed4d56850..f3d53e870385 100644--- a/products/signals/frontend/inbox/utils/reportSelection.ts+++ b/products/signals/frontend/inbox/utils/reportSelection.ts@@ -9,19 +9,19 @@ export type ReportCardClickIntent = 'open' | 'toggle' | 'range'/*** A plain click opens the report until something is selected; from then on the list is in- * selection mode and the same click toggles instead. Cmd / Ctrl always toggles, shift always- * ranges, so a selection can start from an empty list.+ * selection mode and the same click toggles instead. Cmd / Ctrl keeps browser navigation,+ * while shift selects a range, so a selection can start from an empty list.*/export function resolveReportCardClickIntent(modifiers: { shiftKey: boolean; metaKey: boolean; ctrlKey: boolean },hasSelection: boolean): ReportCardClickIntent {+ if (modifiers.metaKey || modifiers.ctrlKey) {+ return 'open'+ }if (modifiers.shiftKey) {return 'range'}- if (modifiers.metaKey || modifiers.ctrlKey) {- return 'toggle'- }return hasSelection ? 'toggle' : 'open'}