: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(desktop): restore plan fullscreen expansion (#77784)
Matt Pua93dfc125c92d
diff --git a/products/desktop/packages/ui/src/features/permissions/PlanContent.test.tsx b/products/desktop/packages/ui/src/features/permissions/PlanContent.test.tsxnew file mode 100644index 000000000000..07d83cd198ac--- /dev/null+++ b/products/desktop/packages/ui/src/features/permissions/PlanContent.test.tsx@@ -0,0 +1,121 @@+import { Theme } from "@radix-ui/themes";+import { fireEvent, render, screen, within } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { describe, expect, it, vi } from "vitest";+import { SessionView } from "../sessions/components/SessionView";++vi.mock("@posthog/di/react", () => ({+ useService: () => ({ maybeRevertBypassMode: vi.fn() }),+}));++vi.mock("../sessions/components/ThreadView", async () => {+ const { PlanContent } = await import("./PlanContent");+ return {+ ThreadView: () => (+ <PlanContent id="test-plan" plan="# Test plan\n\nShip the fix." />+ ),+ };+});++vi.mock("../sessions/hooks/useSessionEventsResidency", () => ({+ useSessionEventsResidency: vi.fn(),+}));+vi.mock("../sessions/hooks/useContextUsage", () => ({+ useContextUsage: () => null,+}));+vi.mock("../sessions/hooks/useEditQueuedMessage", () => ({+ useCancelQueuedMessageEdit: () => vi.fn(),+}));+vi.mock("../sessions/hooks/useToggleMessagingMode", () => ({+ useToggleMessagingMode: () => vi.fn(),+}));+vi.mock("../sessions/sessionStore", () => ({+ useAdapterForTask: () => undefined,+ useConfigOptionForTask: () => undefined,+ useModeConfigOptionForTask: () => undefined,+ useModelConfigOptionForTask: () => undefined,+ usePendingPermissionsForTask: () => new Map(),+ useSessionSelector: () => false,+ useThoughtLevelConfigOptionForTask: () => undefined,+}));+vi.mock("../sessions/sessionViewStore", () => ({+ useSessionViewActions: () => ({ setShowRawLogs: vi.fn() }),+ useShowRawLogs: () => false,+}));+vi.mock("../sessions/useSession", () => ({+ useSessionHandoffInProgress: () => false,+}));+vi.mock("../feature-flags/useFeatureFlag", () => ({+ useFeatureFlag: () => false,+}));+vi.mock("../message-editor/draftStore", () => ({+ useDraftStore: (selector: (state: unknown) => unknown) =>+ selector({ actions: { requestFocus: vi.fn(), setContext: vi.fn() } }),+}));+vi.mock("../message-editor/useAutoFocusOnTyping", () => ({+ useAutoFocusOnTyping: vi.fn(),+}));+vi.mock("../settings/settingsStore", () => ({+ useSettingsStore: (selector?: (state: unknown) => unknown) => {+ const state = { allowBypassPermissions: false, useNewChatThread: false };+ return selector ? selector(state) : state;+ },+}));+vi.mock("../workspace/useWorkspace", () => ({+ useIsWorkspaceCloudRun: () => false,+}));+vi.mock("../../hooks/useConnectivity", () => ({+ useConnectivity: () => ({ isOnline: true }),+}));+vi.mock("../../shell/pendingTaskPromptStore", () => ({+ pendingTaskPromptStoreApi: { clear: vi.fn() },+ usePendingTaskPrompt: () => null,+}));++function renderPlanSession() {+ return render(+ <Theme>+ <SessionView+ events={[]}+ isRunning={false}+ hideInput+ onSendPrompt={async () => true}+ onCancelPrompt={vi.fn()}+ />+ </Theme>,+ );+}++describe("PlanContent fullscreen", () => {+ it("expands into the portal owned by SessionView", async () => {+ const user = userEvent.setup();+ renderPlanSession();++ await user.click(+ screen.getByRole("button", { name: "Expand to fullscreen" }),+ );++ const portal = document.getElementById("fullscreen-portal");+ expect(portal).not.toBeNull();+ expect(portal).toHaveTextContent("Test plan");+ expect(+ within(portal as HTMLElement).getByRole("button", {+ name: "Exit fullscreen",+ }),+ ).toBeInTheDocument();+ });++ it("exits fullscreen when Escape is pressed", async () => {+ const user = userEvent.setup();+ renderPlanSession();++ await user.click(+ screen.getByRole("button", { name: "Expand to fullscreen" }),+ );+ fireEvent.keyDown(window, { key: "Escape" });++ expect(+ screen.getByRole("button", { name: "Expand to fullscreen" }),+ ).toBeInTheDocument();+ });+});diff --git a/products/desktop/packages/ui/src/features/permissions/PlanContent.tsx b/products/desktop/packages/ui/src/features/permissions/PlanContent.tsxindex ed9afab632ca..c6f354ee2076 100644--- a/products/desktop/packages/ui/src/features/permissions/PlanContent.tsx+++ b/products/desktop/packages/ui/src/features/permissions/PlanContent.tsx@@ -82,6 +82,7 @@ export function PlanContent({ id, plan }: PlanContentProps) {color="gray"onClick={() => setIsFullscreen(false)}title="Exit fullscreen"+ aria-label="Exit fullscreen"><ArrowsIn size={12} /></IconButton>@@ -108,6 +109,7 @@ export function PlanContent({ id, plan }: PlanContentProps) {variant="ghost"color="gray"onClick={handleCopy}+ aria-label="Copy plan to clipboard">{copied ? <Check size={12} /> : <Copy size={12} />}</IconButton>@@ -118,6 +120,7 @@ export function PlanContent({ id, plan }: PlanContentProps) {variant="ghost"color="gray"onClick={() => setIsFullscreen(false)}+ aria-label="Exit fullscreen"><X size={14} /></IconButton>@@ -154,6 +157,7 @@ export function PlanContent({ id, plan }: PlanContentProps) {variant="ghost"color="gray"onClick={handleCopy}+ aria-label="Copy plan to clipboard">{copied ? <Check size={12} /> : <Copy size={12} />}</IconButton>@@ -164,6 +168,7 @@ export function PlanContent({ id, plan }: PlanContentProps) {variant="ghost"color="gray"onClick={() => setIsFullscreen(true)}+ aria-label="Expand to fullscreen"><ArrowsOut size={12} /></IconButton>diff --git a/products/desktop/packages/ui/src/features/sessions/components/ConversationView.tsx b/products/desktop/packages/ui/src/features/sessions/components/ConversationView.tsxindex f6daa6e6c968..e935e8ef9768 100644--- a/products/desktop/packages/ui/src/features/sessions/components/ConversationView.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/ConversationView.tsx@@ -506,10 +506,6 @@ export function ConversationView({className="group/thread relative flex-1"onPointerDownCapture={clearKeyboardFocus}>- <div- id="fullscreen-portal"- className="pointer-events-none absolute inset-0 z-20"- />{search.open && (<ConversationSearchBarref={search.searchBarRef}diff --git a/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx b/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsxindex 3efce93a93eb..e3fbc2e2a019 100644--- a/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx@@ -626,6 +626,10 @@ export function SessionView({onDragOver={handleDragOver}onDrop={handleDrop}>+ <div+ id="fullscreen-portal"+ className="pointer-events-none absolute inset-0 z-20"+ />{isSuspended ? (<><ThreadView