Skip to content

Commit 0949057

Browse files
authored
Replace browser tabs with title bar search
Swap the visible browser-style tab strip for a centered global search trigger while keeping route reconciliation mounted without tab-specific shortcuts. Generated-By: PostHog Code Task-Id: 450712fc-39f6-49b8-a3e9-926069ec2760
1 parent 437c331 commit 0949057

4 files changed

Lines changed: 55 additions & 13 deletions

File tree

packages/ui/src/features/browser-tabs/AGENTS.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ differ. Desktop ships first.
7070
## UX
7171

7272
### The strip
73-
- Lives in the Channels title bar, after a `#title-bar-left` section sized to the
74-
Channels sidebar width so the strip starts flush with the content pane.
73+
- The browser-style strip is no longer rendered. The title bar uses a centered,
74+
Slack-style search trigger that opens the existing command menu for commands,
75+
channels, and tasks.
76+
- `BrowserTabStrip` remains mounted in reconciliation-only mode so persisted tab
77+
state and restored routes continue to settle safely while tab-only controls
78+
and keyboard shortcuts stay disabled.
7579
- Each tab is a quill `Button` (variant `default`). The active tab is elevated;
7680
inactive tabs are muted. Tabs **shrink to fit** — the strip never scrolls
7781
(`overflow-hidden`, pills `flex-1 basis-[200px]` capped at `max-w-[200px]`).

packages/ui/src/features/browser-tabs/BrowserTabStrip.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ function isAppView(value: string): value is AppView {
152152
return value in APP_VIEW_META;
153153
}
154154

155-
export function BrowserTabStrip() {
155+
interface BrowserTabStripProps {
156+
showTabs?: boolean;
157+
}
158+
159+
export function BrowserTabStrip({ showTabs = true }: BrowserTabStripProps) {
156160
const logger = useService<RootLogger>(ROOT_LOGGER);
157161
const snapshot = useTabsSnapshot();
158162
const navigate = useNavigate();
@@ -804,7 +808,7 @@ export function BrowserTabStrip() {
804808
{
805809
enableOnFormTags: true,
806810
enableOnContentEditable: true,
807-
enabled: !isCloudRun,
811+
enabled: showTabs && !isCloudRun,
808812
},
809813
);
810814

@@ -818,7 +822,11 @@ export function BrowserTabStrip() {
818822
if (taskHasCloseableEditorTab(params.taskId)) return;
819823
if (activeTabId) handleClose(activeTabId);
820824
},
821-
{ enableOnFormTags: true, enableOnContentEditable: true },
825+
{
826+
enableOnFormTags: true,
827+
enableOnContentEditable: true,
828+
enabled: showTabs,
829+
},
822830
);
823831

824832
// With channels on, Cmd/Ctrl+1-9 switches to the Nth browser tab (in the
@@ -839,12 +847,12 @@ export function BrowserTabStrip() {
839847
enableOnFormTags: true,
840848
enableOnContentEditable: true,
841849
preventDefault: true,
842-
enabled: channelsEnabled,
850+
enabled: showTabs && channelsEnabled,
843851
},
844852
[tabs, handleSelect],
845853
);
846854

847-
return (
855+
return showTabs ? (
848856
<TabStrip
849857
tabs={tabs}
850858
activeTabId={activeTabId}
@@ -856,5 +864,5 @@ export function BrowserTabStrip() {
856864
onCloseToLeft={handleCloseToLeft}
857865
onNewTab={isCloudRun ? undefined : handleNewTab}
858866
/>
859-
);
867+
) : null;
860868
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { MagnifyingGlass } from "@phosphor-icons/react";
2+
import { Button, Kbd } from "@posthog/quill";
3+
import { formatHotkeyParts, SHORTCUTS } from "./keyboard-shortcuts";
4+
5+
interface TitleBarSearchProps {
6+
onClick: () => void;
7+
}
8+
9+
export function TitleBarSearch({ onClick }: TitleBarSearchProps) {
10+
return (
11+
<div className="no-drag flex min-w-0 flex-1 justify-center px-4">
12+
<Button
13+
variant="outline"
14+
size="sm"
15+
className="h-7 w-full max-w-[520px] justify-start gap-2 bg-gray-3/80 px-2.5 text-gray-11 shadow-sm backdrop-blur-sm hover:bg-gray-4 hover:text-gray-12"
16+
aria-label="Search PostHog Code"
17+
onClick={onClick}
18+
>
19+
<MagnifyingGlass size={14} className="shrink-0" />
20+
<span className="truncate">Search PostHog Code</span>
21+
<span className="ml-auto flex shrink-0 items-center gap-1">
22+
{formatHotkeyParts(SHORTCUTS.COMMAND_MENU).map((part) => (
23+
<Kbd key={part}>{part}</Kbd>
24+
))}
25+
</span>
26+
</Button>
27+
</div>
28+
);
29+
}

packages/ui/src/router/routes/__root.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { useChannelDeepLink } from "@posthog/ui/features/canvas/hooks/useChannel
3434
import { CommandMenu } from "@posthog/ui/features/command/CommandMenu";
3535
import { GlobalFilePicker } from "@posthog/ui/features/command/GlobalFilePicker";
3636
import { KeyboardShortcutsSheet } from "@posthog/ui/features/command/KeyboardShortcutsSheet";
37+
import { TitleBarSearch } from "@posthog/ui/features/command/TitleBarSearch";
3738
import { ConnectivityBanner } from "@posthog/ui/features/connectivity/ConnectivityBanner";
3839
import { useNewTaskDeepLink } from "@posthog/ui/features/deep-links/useNewTaskDeepLink";
3940
import { useOpenTargetDeepLink } from "@posthog/ui/features/deep-links/useOpenTargetDeepLink";
@@ -418,11 +419,11 @@ function RootLayout() {
418419
</Flex>
419420
)}
420421
</Flex>
421-
{/* Tabs work in both spaces: channel tabs under /website and plain
422-
task tabs in the Code experience. The strip's route→tab effect
423-
noops on param-less routes (inbox, agents, new-task), so it's safe
424-
to mount everywhere. */}
425-
<BrowserTabStrip />
422+
<TitleBarSearch onClick={() => setCommandMenuOpen(true)} />
423+
{/* Keep route/tab reconciliation mounted while the old browser-tab
424+
chrome is hidden. This preserves restored routes and persisted
425+
state without exposing tab-specific controls or shortcuts. */}
426+
<BrowserTabStrip showTabs={false} />
426427
{/* Gated so an empty right-side group can't claim a no-drag rect
427428
in the title bar for nothing — every pixel without controls
428429
should drag the window. */}

0 commit comments

Comments
 (0)