Skip to content

: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.

fix(today): render rail items as links so they open in a new tab (#111962)

Adam Leithbd9dfa1973ae
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index a71732c40b7d..b0d4a60d58e2 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -2873,7 +2873,7 @@ snapshots:
errortracking-exceptioncard--exception-card-base--light:
hash: v1.k794b7964.40a5fd88410919603dc60b886450c6011806a70502e144dfc559380eec5cd9cf.LXtqQwhm5OiXOmRO3LnQdS-BtoNHpRABg21xA3_FthY
errortracking-exceptioncard--exception-card-header-widths--dark:
- hash: v1.k794b7964.2fd597859f64b0598f04d444d1951665d553891c260eca98bc237e1d9a131c3a.Jej64hrDTzRNtzVbCfTVReFGSTXB5yd-sgRKzs2hKt8
+ hash: v1.k794b7964.51badf8f8e16413e7e9d0cf410ea7b7ab349d566b2df111cd6ce8e52d6482f3a.LWGWR4hXx5Ax0XkCrRTxYq0LwuceCz-ox3xyKzqFrdA
errortracking-exceptioncard--exception-card-header-widths--light:
hash: v1.k794b7964.96ab37bc32797721d97410925e8c89bf739322a340ff8ee62dbd014a139a7f59.HCV39CI_4XqbwUW8QD8DDxSw_CeL5cui9smBv0MDeY0
errortracking-exceptioncard--exception-card-header-widths-with-action--dark:
diff --git a/frontend/src/layout/today/TodayRail.tsx b/frontend/src/layout/today/TodayRail.tsx
index 1cadd451f569..c2375b3f6f54 100644
--- a/frontend/src/layout/today/TodayRail.tsx
+++ b/frontend/src/layout/today/TodayRail.tsx
@@ -14,7 +14,7 @@ import { organizationLogic } from 'scenes/organizationLogic'
import { TODAY_RAIL_ITEMS } from './todayRailItems'
import { TodayRailTile } from './TodayRailTile'
-import { TODAY_RAIL_WIDTH, todayShellLogic } from './todayShellLogic'
+import { TODAY_RAIL_WIDTH, railPaneHref, todayShellLogic } from './todayShellLogic'
function RailUtility({
label,
@@ -69,6 +69,7 @@ export function TodayRail(): JSX.Element {
label={label}
icon={icon}
active={activePane === pane}
+ to={railPaneHref(pane)}
onClick={() => pickPane(pane)}
dataAttr={`today-rail-${pane}`}
/>
diff --git a/frontend/src/layout/today/TodayRailTile.tsx b/frontend/src/layout/today/TodayRailTile.tsx
index 0ed3828142ef..4a07b4d9cc4d 100644
--- a/frontend/src/layout/today/TodayRailTile.tsx
+++ b/frontend/src/layout/today/TodayRailTile.tsx
@@ -1,21 +1,28 @@
import { cn } from '@posthog/quill'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+
export interface TodayRailTileProps {
label: string
icon: JSX.Element
active: boolean
+ to: string | undefined
onClick: () => void
dataAttr: string
}
-export function TodayRailTile({ label, icon, active, onClick, dataAttr }: TodayRailTileProps): JSX.Element {
+export function TodayRailTile({ label, icon, active, to, onClick, dataAttr }: TodayRailTileProps): JSX.Element {
return (
- <button
- type="button"
+ <LinkPrimitive
+ to={to}
aria-label={label}
aria-current={active ? 'page' : undefined}
data-attr={dataAttr}
- onClick={onClick}
+ onClick={(event) => {
+ // Cmd/ctrl and middle clicks never reach here, so the browser still opens those in a new tab.
+ event.preventDefault()
+ onClick()
+ }}
className={cn(
'group flex w-full shrink-0 cursor-pointer flex-col items-center gap-1 outline-none hover:text-foreground',
active ? 'text-foreground' : 'text-muted-foreground'
@@ -31,6 +38,6 @@ export function TodayRailTile({ label, icon, active, onClick, dataAttr }: TodayR
{icon}
</span>
<span className="max-w-full truncate px-0.5 text-[10px] leading-3 font-medium">{label}</span>
- </button>
+ </LinkPrimitive>
)
}
diff --git a/frontend/src/layout/today/todayShellLogic.ts b/frontend/src/layout/today/todayShellLogic.ts
index ab6e2d17f7e6..5c429fbf4eb3 100644
--- a/frontend/src/layout/today/todayShellLogic.ts
+++ b/frontend/src/layout/today/todayShellLogic.ts
@@ -45,6 +45,11 @@ const RAIL_PANE_HOME: Record<Exclude<TodayRailPane, 'more'>, () => string> = {
tools: () => urls.tools(),
}
+/** The page a rail pane opens, or undefined for panes without a page of their own. */
+export function railPaneHref(pane: TodayRailPane): string | undefined {
+ return pane === 'more' ? undefined : RAIL_PANE_HOME[pane]()
+}
+
const PHONE_PAGE_LIMIT = 50
export interface TodayPhonePage {
@@ -324,8 +329,9 @@ export const todayShellLogic = kea<todayShellLogicType>([
pickPane: ({ pane }) => {
// pinned: analytics event name and property. Renaming them breaks dashboards.
posthog.capture('today rail pane picked', { pane, phone_layout: values.phoneLayout })
- if (pane !== 'more') {
- router.actions.push(RAIL_PANE_HOME[pane]())
+ const href = railPaneHref(pane)
+ if (href) {
+ router.actions.push(href)
}
if (values.mobileLayout) {
actions.setMobileSidebarOpen(true)