Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(open-knowledge): right-docked terminal / doc-panel layout interactions (#2393)

serafin-garciadd2e3dcec2d9
diff --git a/.changeset/fix-terminal-doc-panel-resize.md b/.changeset/fix-terminal-doc-panel-resize.md
new file mode 100644
index 000000000..e6bfde197
--- /dev/null
+++ b/.changeset/fix-terminal-doc-panel-resize.md
@@ -0,0 +1,14 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Fix the right-docked terminal and the doc panel fighting over space. Six confusing interactions are gone:
+
+1. Dragging the terminal narrower no longer pops the closed doc panel open — the space returns to the editor.
+2. With the doc panel closed, the two resize handles no longer overlap at the same pixel seam — a drag aimed at the terminal edge can't land on the (now inert) doc-panel handle and expand the doc panel instead.
+3. Closing the doc panel while the terminal is open no longer inflates the terminal; the editor absorbs the width, and the terminal keeps its own size.
+4. The terminal column can now be dragged shut: dragging it below half its minimum width snaps it closed and hides it on release, matching the doc panel's drag-to-close affordance. (The hide button still works.)
+5. Hiding the terminal no longer resurrects a doc panel you had closed while it was open (and showing the terminal no longer restores a stale doc-panel state either) — the doc panel keeps whatever state it was in.
+6. Collapsing the left file sidebar no longer widens the terminal column (measured 480px → 673px before the fix) — the editor absorbs the freed space while the doc panel and terminal hold their pinned widths.
+
+Closed panels are now consistently button-only to reopen: a collapsed doc panel no longer exposes a draggable rail handle (use the toolbar toggle or ⌥⌘B), matching the terminal, whose handle disappears when it is hidden.
diff --git a/packages/app/src/components/EditorArea.dom.test.tsx b/packages/app/src/components/EditorArea.dom.test.tsx
index 4d7c502bc..00ed7a9dc 100644
--- a/packages/app/src/components/EditorArea.dom.test.tsx
+++ b/packages/app/src/components/EditorArea.dom.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';
-import { act, cleanup, render, screen } from '@testing-library/react';
+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react';
import { type ReactNode, useEffect } from 'react';
type SettingsDialogShellProps = {
@@ -103,11 +103,24 @@ mock.module('./TerminalDock', () => ({
},
}));
+let groupLayout: Record<string, number> = {};
+let groupSetLayoutCalls: Array<Record<string, number>> = [];
+let panelIsCollapsed = false;
mock.module('react-resizable-panels', () => ({
usePanelRef: () => ({
current: {
collapse: () => {},
expand: () => {},
+ getSize: () => ({ asPercentage: 25, inPixels: 340 }),
+ isCollapsed: () => panelIsCollapsed,
+ },
+ }),
+ useGroupRef: () => ({
+ current: {
+ getLayout: () => groupLayout,
+ setLayout: (layout: Record<string, number>) => {
+ groupSetLayoutCalls.push(layout);
+ },
},
}),
}));
@@ -117,7 +130,9 @@ mock.module('@/components/ui/resizable', () => ({
<div data-testid="resizable-group">{children}</div>
),
ResizablePanel: ({ children }: { children: ReactNode }) => <div>{children}</div>,
- ResizableHandle: () => <div data-testid="resizable-handle" />,
+ ResizableHandle: ({ onPointerDown }: { onPointerDown?: (e: unknown) => void }) => (
+ <div data-testid="resizable-handle" onPointerDown={onPointerDown} />
+ ),
}));
mock.module('@/hooks/use-doc-panel-layout', () => ({
@@ -278,6 +293,108 @@ describe('EditorArea empty-state terminal host', () => {
});
});
+describe('EditorArea right-rail layout assert on terminal-column mount/unmount', () => {
+ const setViewportWidth = (px: number) => {
+ Object.defineProperty(window, 'innerWidth', {
+ value: px,
+ configurable: true,
+ writable: true,
+ });
+ };
+
+ const baseProps = {
+ editorMode: 'wysiwyg',
+ onModeChange: () => {},
+ activeTab: 'timeline',
+ onActiveTabChange: () => {},
+ terminalBridge: {} as never,
+ terminalDock: 'right',
+ onTerminalVisibleChange: () => {},
+ } as const;
+
+ const MOCK_GROUP_PX = 1360;
+ const pctOf = (px: number) => (px / MOCK_GROUP_PX) * 100;
+
+ beforeEach(() => {
+ cleanup();
+ docCtx = EMPTY_DOC_CTX;
+ groupLayout = {};
+ groupSetLayoutCalls = [];
+ panelIsCollapsed = false;
+ });
+
+ test('hiding the terminal re-asserts the collapsed doc panel over the stale panel-set restore', async () => {
+ setViewportWidth(1024);
+ const view = render(<EditorArea {...baseProps} terminalVisible />);
+ expect(groupSetLayoutCalls).toHaveLength(0);
+ groupLayout = { 'editor-main': 70, 'doc-panel': 30 };
+ view.rerender(<EditorArea {...baseProps} terminalVisible={false} />);
+ await act(async () => {});
+ const corrected = groupSetLayoutCalls.at(-1);
+ expect(corrected).toBeDefined();
+ expect(corrected?.['doc-panel']).toBe(0);
+ expect(corrected?.['editor-main']).toBe(100);
+ });
+
+ test('revealing the terminal keeps the open doc panel open despite a stale cached layout', async () => {
+ setViewportWidth(1400);
+ const view = render(<EditorArea {...baseProps} terminalVisible={false} />);
+ groupLayout = { 'editor-main': 45, 'doc-panel': 25, 'terminal-column': 30 };
+ view.rerender(<EditorArea {...baseProps} terminalVisible />);
+ await act(async () => {});
+ const corrected = groupSetLayoutCalls.at(-1);
+ expect(corrected).toBeDefined();
+ expect(corrected?.['doc-panel']).toBeCloseTo(pctOf(320), 3);
+ expect(corrected?.['terminal-column']).toBeCloseTo(pctOf(480), 3);
+ expect(corrected?.['editor-main']).toBeCloseTo(100 - pctOf(320) - pctOf(480), 3);
+ });
+
+ test('releasing a terminal-handle drag with the column snapped shut hides the terminal', async () => {
+ setViewportWidth(1400);
+ const visibleChanges: boolean[] = [];
+ render(
+ <EditorArea
+ {...baseProps}
+ terminalVisible
+ onTerminalVisibleChange={(visible: boolean) => {
+ visibleChanges.push(visible);
+ }}
+ />,
+ );
+ const handle = screen.getByTestId('resizable-handle');
+ act(() => {
+ fireEvent.pointerDown(handle);
+ });
+ panelIsCollapsed = true;
+ act(() => {
+ fireEvent.pointerUp(window);
+ });
+ expect(visibleChanges.at(-1)).toBe(false);
+ });
+
+ test('releasing a terminal-handle drag with the column still open does NOT hide the terminal', async () => {
+ setViewportWidth(1400);
+ const visibleChanges: boolean[] = [];
+ render(
+ <EditorArea
+ {...baseProps}
+ terminalVisible
+ onTerminalVisibleChange={(visible: boolean) => {
+ visibleChanges.push(visible);
+ }}
+ />,
+ );
+ const handle = screen.getByTestId('resizable-handle');
+ act(() => {
+ fireEvent.pointerDown(handle);
+ });
+ act(() => {
+ fireEvent.pointerUp(window);
+ });
+ expect(visibleChanges).toHaveLength(0);
+ });
+});
+
describe('EditorArea folder-view terminal host', () => {
beforeEach(() => {
cleanup();
diff --git a/packages/app/src/components/EditorArea.tsx b/packages/app/src/components/EditorArea.tsx
index 9db5a1017..aede50219 100644
--- a/packages/app/src/components/EditorArea.tsx
+++ b/packages/app/src/components/EditorArea.tsx
@@ -11,7 +11,7 @@ import {
useRef,
useState,
} from 'react';
-import { usePanelRef } from 'react-resizable-panels';
+import { useGroupRef, usePanelRef } from 'react-resizable-panels';
import { AssetPreview } from '@/components/AssetPreview';
import { DocPanel, type PanelTab } from '@/components/DocPanel';
import {
@@ -58,6 +58,7 @@ import { EditorFooter } from './EditorFooter';
import type { EditorMode } from './EditorPane';
import { EditorToolbar } from './EditorToolbar';
import { shouldPaintOverlay } from './editor-area-overlay';
+import { computeStickyRepinLayout } from './editor-area-sticky-repin';
import { TerminalDock } from './TerminalDock';
import { TerminalRevealTab } from './TerminalRevealTab';
import { xtermThemeForMode } from './terminal-theme';
@@ -70,6 +71,8 @@ const LazyActivityModeContent = lazy(async () => {
const DOC_PANEL_MIN_SIZE = '300px';
const DOC_PANEL_MAX_SIZE = '600px';
+const RIGHT_PANEL_IDS = new Set(['doc-panel', 'terminal-column', 'agent-panel']);
+
export interface TerminalPlacement {
readonly container: HTMLElement | null;
readonly isShowing: boolean;
@@ -197,6 +200,7 @@ function EditorAreaInner({
const rightDocked = terminalDock === 'right';
const terminalDockPosition: TerminalDockPosition = rightDocked ? 'right' : 'bottom';
+ const terminalColumnPresent = terminalBridge != null && rightDocked && terminalVisible;
const revealTabHidden = terminalBridge != null && !terminalVisible && onRevealTerminal != null;
const bottomRevealTabPresent = revealTabHidden && !rightDocked;
const rightRevealTabPresent = revealTabHidden && rightDocked;
@@ -260,16 +264,85 @@ function EditorAreaInner({
);
const [groupContainerEl, setGroupContainerEl] = useState<HTMLDivElement | null>(null);
+ const groupContainerElRef = useRef<HTMLDivElement | null>(null);
+
+ const groupRef = useGroupRef();
+ const terminalColumnPresentRef = useRef(terminalColumnPresent);
+ useEffect(() => {
+ terminalColumnPresentRef.current = terminalColumnPresent;
+ }, [terminalColumnPresent]);
+
+ function resolveGroupPxWidth(): number | null {
+ for (const ref of [panelRef, terminalColumnPanelRef]) {
+ const size = ref.current?.getSize();
+ if (size != null && size.asPercentage > 1 && size.inPixels > 0) {
+ return (size.inPixels / size.asPercentage) * 100;
+ }
+ }
+ const el = groupContainerElRef.current;
+ return el != null && el.offsetWidth > 0 ? el.offsetWidth : null;
+ }
+
+ function assertRightRailLayout(docCollapsed: boolean) {
+ if (isDraggingDocHandleRef.current || isDraggingTerminalHandleRef.current) return;
+ const group = groupRef.current;
+ if (group == null) return;
+ try {
+ const containerPx = resolveGroupPxWidth();
+ if (containerPx == null) return;
+ const layout = group.getLayout();
+ const ids = Object.keys(layout);
+ if (ids.length === 0) return;
+ const residualId = ids.find((id) => !RIGHT_PANEL_IDS.has(id));
+ if (residualId == null) return;
+ const pinnedPx: Record<string, number> = {};
+ if ('doc-panel' in layout) {
+ pinnedPx['doc-panel'] = docCollapsed ? 0 : docPanelWidthPxRef.current;
+ }
+ if ('terminal-column' in layout) {
+ pinnedPx['terminal-column'] = terminalWidthPxRef.current;
+ }
+ if (Object.keys(pinnedPx).length === 0) return;
+ const next = computeStickyRepinLayout({
+ currentLayout: layout,
+ containerPx,
+ pinnedPx,
+ residualId,
+ });
+ if (next !== layout) group.setLayout(next);
+ } catch {}
+ }
+
+ const assertRightRailLayoutRef = useRef(assertRightRailLayout);
+ useEffect(() => {
+ assertRightRailLayoutRef.current = assertRightRailLayout;
+ });
+
+ function expandDocPanel() {
+ if (terminalColumnPresentRef.current) {
+ assertRightRailLayout(false);
+ } else {
+ panelRef.current?.expand();
+ }
+ }
function togglePanel() {
if (panelRef.current == null) return;
const partition = rightPartitionRef.current;
if (isCollapsed) {
applyToggle('right', partition, 'open');
- panelRef.current?.expand();
+ if (terminalColumnPresentRef.current) {
+ assertRightRailLayout(false);
+ } else {
+ panelRef.current?.expand();
+ }
} else {
applyToggle('right', partition, 'collapsed');
- panelRef.current?.collapse();
+ if (terminalColumnPresentRef.current) {
+ assertRightRailLayout(true);
+ } else {
+ panelRef.current?.collapse();
+ }
}
}
@@ -282,7 +355,9 @@ function EditorAreaInner({
const effective = resolveEffectiveState('right', newPartition, pins);
const nextCollapsed = effective === 'collapsed';
setIsCollapsed(nextCollapsed);
- if (nextCollapsed) {
+ if (terminalColumnPresentRef.current) {
+ assertRightRailLayout(nextCollapsed);
+ } else if (nextCollapsed) {
panelRef.current?.collapse();
} else {
panelRef.current?.expand();
@@ -290,27 +365,27 @@ function EditorAreaInner({
};
mql.addEventListener('change', onChange);
return () => mql.removeEventListener('change', onChange);
- }, [embeddedHost, panelRef]);
+ }, [
+ embeddedHost,
+ panelRef,
+ // biome-ignore lint/correctness/useExhaustiveDependencies: assertRightRailLayout is render-bound; re-subscribing keeps the handler fresh (mirrors the ⌥⌘B menu effect below)
+ assertRightRailLayout,
+ ]);
useEffect(() => {
if (groupContainerEl == null) return;
if (isEmbedded) return;
const ro = new ResizeObserver(() => {
- if (!isDraggingDocHandleRef.current && !isCollapsedRef.current) {
- panelRef.current?.resize(`${docPanelWidthPxRef.current}px`);
- }
- if (!isDraggingTerminalHandleRef.current) {
- terminalColumnPanelRef.current?.resize(`${terminalWidthPxRef.current}px`);
- }
+ assertRightRailLayoutRef.current(isCollapsedRef.current);
});
ro.observe(groupContainerEl);
return () => ro.disconnect();
- }, [groupContainerEl, isEmbedded, panelRef, terminalColumnPanelRef]);
+ }, [groupContainerEl, isEmbedded]);
useEffect(() => {
const openRequestedTab = (tab: PanelTab) => {
onActiveTabChange(tab);
- panelRef.current?.expand();
+ expandDocPanel();
};
const pendingTab = consumePendingDocPanelTabRequest();
@@ -322,12 +397,30 @@ function EditorAreaInner({
consumePendingDocPanelTabRequest();
openRequestedTab(tab);
});
- }, [onActiveTabChange, panelRef]);
+ }, [
+ onActiveTabChange,
+ // biome-ignore lint/correctness/useExhaustiveDependencies: expandDocPanel is render-bound; re-subscribing keeps the handler fresh
+ expandDocPanel,
+ ]);
useEffect(() => {
if (docPanelExpandSignal === 0) return;
- panelRef.current?.expand();
- }, [docPanelExpandSignal, panelRef]);
+ expandDocPanel();
+ }, [
+ docPanelExpandSignal,
+ // biome-ignore lint/correctness/useExhaustiveDependencies: expandDocPanel is render-bound; re-running keeps the closure fresh
+ expandDocPanel,
+ ]);
+
+ const prevTerminalColumnPresentRef = useRef(terminalColumnPresent);
+ useLayoutEffect(() => {
+ if (prevTerminalColumnPresentRef.current === terminalColumnPresent) return;
+ prevTerminalColumnPresentRef.current = terminalColumnPresent;
+ const docCollapsed = isCollapsed;
+ queueMicrotask(() => {
+ assertRightRailLayoutRef.current(docCollapsed);
+ });
+ }, [terminalColumnPresent, isCollapsed]);
useLayoutEffect(() => {
if (!isCollapsed) return;
@@ -635,11 +728,12 @@ function EditorAreaInner({
);
viewContent = editorContent;
+ const docPanelNeutralized = terminalColumnPresent && isCollapsed;
rightPanel = (
<>
<ResizableHandle
- withHandle
- disabled={isEmbedded && isCollapsed}
+ withHandle={!isCollapsed}
+ disabled={isCollapsed}
onPointerDown={() => {
setIsDraggingDocHandle(true);
isDraggingDocHandleRef.current = true;
@@ -654,8 +748,9 @@ function EditorAreaInner({
<ResizablePanel
id="doc-panel"
panelRef={panelRef}
+ disabled={docPanelNeutralized}
defaultSize={initialRightCollapsed ? 0 : `${initialDocPanelWidthPx}px`}
- minSize={DOC_PANEL_MIN_SIZE}
+ minSize={docPanelNeutralized ? '0px' : DOC_PANEL_MIN_SIZE}
maxSize={DOC_PANEL_MAX_SIZE}
collapsible
collapsedSize={0}
@@ -701,7 +796,6 @@ function EditorAreaInner({
viewContent
);
- const terminalColumnPresent = terminalBridge != null && rightDocked && terminalVisible;
const terminalColumn = terminalColumnPresent ? (
<>
<ResizableHandle
@@ -713,6 +807,9 @@ function EditorAreaInner({
setIsDraggingTerminalHandle(false);
isDraggingTerminalHandleRef.current = false;
window.removeEventListener('pointerup', handleUp);
+ if (terminalColumnPanelRef.current?.isCollapsed()) {
+ onTerminalVisibleChange?.(false);
+ }
};
window.addEventListener('pointerup', handleUp);
}}
@@ -724,6 +821,8 @@ function EditorAreaInner({
defaultSize={`${initialTerminalWidthPx}px`}
minSize={`${MIN_TERMINAL_WIDTH}px`}
maxSize={`${MAX_TERMINAL_WIDTH}px`}
+ collapsible
+ collapsedSize={0}
onResize={(size) => {
if (size.inPixels > 0 && isDraggingTerminalHandleRef.current) {
terminalWidthPxRef.current = size.inPixels;
@@ -749,9 +848,16 @@ function EditorAreaInner({
(rightPanel != null && !initialRightCollapsed) || terminalColumnPresent;
return (
- <div className="relative flex min-h-0 flex-1" ref={setGroupContainerEl}>
+ <div
+ className="relative flex min-h-0 flex-1"
+ ref={(el) => {
+ setGroupContainerEl(el);
+ groupContainerElRef.current = el;
+ }}
+ >
<ResizablePanelGroup
orientation="horizontal"
+ groupRef={groupRef}
data-dragging={isDraggingDocHandle || isDraggingTerminalHandle || undefined}
>
<ResizablePanel
diff --git a/packages/app/src/components/editor-area-sticky-repin.test.ts b/packages/app/src/components/editor-area-sticky-repin.test.ts
new file mode 100644
index 000000000..8d6a04233
--- /dev/null
+++ b/packages/app/src/components/editor-area-sticky-repin.test.ts
@@ -0,0 +1,113 @@
+import { describe, expect, test } from 'bun:test';
+import { computeStickyRepinLayout } from './editor-area-sticky-repin';
+
+describe('computeStickyRepinLayout', () => {
+ test('pins a single pixel panel and gives the residual panel the rest (editor | doc)', () => {
+ const next = computeStickyRepinLayout({
+ currentLayout: { editor: 70, 'doc-panel': 30 },
+ containerPx: 1000,
+ pinnedPx: { 'doc-panel': 300 },
+ residualId: 'editor',
+ });
+ expect(next['doc-panel']).toBeCloseTo(30, 6);
+ expect(next.editor).toBeCloseTo(70, 6);
+ expect(next.editor + next['doc-panel']).toBeCloseTo(100, 6);
+ });
+
+ test('pins two pixel panels; the residual (editor) absorbs the delta (editor | doc | terminal)', () => {
+ const next = computeStickyRepinLayout({
+ currentLayout: { editor: 40, 'doc-panel': 25, 'terminal-column': 35 },
+ containerPx: 1000,
+ pinnedPx: { 'doc-panel': 300, 'terminal-column': 400 },
+ residualId: 'editor',
+ });
+ expect(next['doc-panel']).toBeCloseTo(30, 6);
+ expect(next['terminal-column']).toBeCloseTo(40, 6);
+ expect(next.editor).toBeCloseTo(30, 6);
+ expect(next.editor + next['doc-panel'] + next['terminal-column']).toBeCloseTo(100, 6);
+ });
+
+ test('holds a collapsed doc panel at 0% and pins the terminal; editor absorbs (the VM scenario)', () => {
+ const next = computeStickyRepinLayout({
+ currentLayout: { editor: 20, 'doc-panel': 0, 'terminal-column': 80 },
+ containerPx: 1000,
+ pinnedPx: { 'terminal-column': 400 },
+ residualId: 'editor',
+ });
+ expect(next['terminal-column']).toBeCloseTo(40, 6);
+ expect(next['doc-panel']).toBe(0);
+ expect(next.editor).toBeCloseTo(60, 6);
+ });
+
+ test('preserves a non-pinned, non-residual panel (agent-panel) in the layout', () => {
+ const next = computeStickyRepinLayout({
+ currentLayout: { editor: 30, 'doc-panel': 20, 'agent-panel': 15, 'terminal-column': 35 },
+ containerPx: 1000,
+ pinnedPx: { 'doc-panel': 250, 'terminal-column': 350 },
+ residualId: 'editor',
+ });
+ expect(next['doc-panel']).toBeCloseTo(25, 6);
+ expect(next['terminal-column']).toBeCloseTo(35, 6);
+ expect(next['agent-panel']).toBeCloseTo(15, 6);
+ expect(next.editor).toBeCloseTo(25, 6);
+ });
+
+ test('pins a collapse: pinning a panel at 0px holds it shut while the residual absorbs', () => {
+ const next = computeStickyRepinLayout({
+ currentLayout: { editor: 70, 'doc-panel': 30 },
+ containerPx: 1000,
+ pinnedPx: { 'doc-panel': 0 },
+ residualId: 'editor',
+ });
+ expect(next['doc-panel']).toBe(0);
+ expect(next.editor).toBeCloseTo(100, 6);
+ });
+
+ test('is a no-op when the container has no measurable width', () => {
+ const input = { editor: 60, 'doc-panel': 40 };
+ expect(
+ computeStickyRepinLayout({
+ currentLayout: input,
+ containerPx: 0,
+ pinnedPx: { 'doc-panel': 300 },
+ residualId: 'editor',
+ }),
+ ).toBe(input);
+ });
+
+ test('is a no-op when the residual panel id is absent from the layout', () => {
+ const input = { 'doc-panel': 40, 'terminal-column': 60 };
+ expect(
+ computeStickyRepinLayout({
+ currentLayout: input,
+ containerPx: 1000,
+ pinnedPx: { 'doc-panel': 300 },
+ residualId: 'editor',
+ }),
+ ).toBe(input);
+ });
+
+ test('is a no-op when the pins cannot fit (residual would be negative)', () => {
+ const input = { editor: 50, 'doc-panel': 25, 'terminal-column': 25 };
+ expect(
+ computeStickyRepinLayout({
+ currentLayout: input,
+ containerPx: 1000,
+ pinnedPx: { 'doc-panel': 600, 'terminal-column': 600 },
+ residualId: 'editor',
+ }),
+ ).toBe(input);
+ });
+
+ test('ignores pins for panels not present in the layout', () => {
+ const next = computeStickyRepinLayout({
+ currentLayout: { editor: 70, 'doc-panel': 30 },
+ containerPx: 1000,
+ pinnedPx: { 'doc-panel': 300, 'terminal-column': 400 },
+ residualId: 'editor',
+ });
+ expect('terminal-column' in next).toBe(false);
+ expect(next['doc-panel']).toBeCloseTo(30, 6);
+ expect(next.editor).toBeCloseTo(70, 6);
+ });
+});
diff --git a/packages/app/src/components/editor-area-sticky-repin.ts b/packages/app/src/components/editor-area-sticky-repin.ts
new file mode 100644
index 000000000..4f102e755
--- /dev/null
+++ b/packages/app/src/components/editor-area-sticky-repin.ts
@@ -0,0 +1,34 @@
+import type { Layout } from 'react-resizable-panels';
+
+interface StickyRepinParams {
+ currentLayout: Layout;
+ containerPx: number;
+ pinnedPx: Record<string, number>;
+ residualId: string;
+}
+
+export function computeStickyRepinLayout(params: StickyRepinParams): Layout {
+ const { currentLayout, containerPx, pinnedPx, residualId } = params;
+ if (containerPx <= 0) return currentLayout;
+ if (!(residualId in currentLayout)) return currentLayout;
+
+ const next: Layout = { ...currentLayout };
+ let pinnedPctSum = 0;
+ for (const [id, px] of Object.entries(pinnedPx)) {
+ if (!(id in currentLayout)) continue;
+ const pct = (px / containerPx) * 100;
+ next[id] = pct;
+ pinnedPctSum += pct;
+ }
+
+ let otherPctSum = 0;
+ for (const [id, pct] of Object.entries(currentLayout)) {
+ if (id === residualId || id in pinnedPx) continue;
+ otherPctSum += pct;
+ }
+
+ const residualPct = 100 - pinnedPctSum - otherPctSum;
+ if (residualPct < 0) return currentLayout;
+ next[residualId] = residualPct;
+ return next;
+}
diff --git a/packages/app/tests/stress/qa-sidebar-responsive.e2e.ts b/packages/app/tests/stress/qa-sidebar-responsive.e2e.ts
index 1ff1c3486..b37bfa220 100644
--- a/packages/app/tests/stress/qa-sidebar-responsive.e2e.ts
+++ b/packages/app/tests/stress/qa-sidebar-responsive.e2e.ts
@@ -190,6 +190,44 @@ test.describe('non-embedded UA', () => {
await expect(toggle).toHaveAttribute('aria-controls', 'doc-panel');
});
+ test('collapsed doc panel exposes a disabled resize handle; expanded stays interactive', async ({
+ page,
+ api,
+ }) => {
+ await seedDoc(api, 'qa-doc-handle-collapse');
+ await page.setViewportSize(WIDE);
+ await page.goto('/#/qa-doc-handle-collapse');
+ await waitForActiveProviderSynced(page);
+
+ const docPanelHandle = page.locator('[data-slot="resizable-handle"]');
+ await expect(docPanelHandle).toHaveCount(1);
+
+ expect(await docPanelOpen(page)).toBe(true);
+ await expect(docPanelHandle).toHaveAttribute('tabindex', '0');
+ await expect(docPanelHandle).not.toHaveAttribute('aria-disabled', 'true');
+
+ await page.locator('[data-doc-panel-toggle]').click();
+ await expect(page.locator('[data-doc-panel-toggle]')).toHaveAttribute('aria-expanded', 'false');
+
+ await expect(docPanelHandle).toHaveAttribute('aria-disabled', 'true');
+ await expect(docPanelHandle).not.toHaveAttribute('tabindex', '0');
+
+ const box = await docPanelHandle.boundingBox();
+ if (box) {
+ const startX = box.x + box.width / 2;
+ const startY = box.y + box.height / 2;
+ await page.mouse.move(startX, startY);
+ await page.mouse.down();
+ await page.mouse.move(startX - 320, startY, { steps: 10 });
+ await page.mouse.up();
+ }
+ await expect(page.locator('[data-doc-panel-toggle]')).toHaveAttribute('aria-expanded', 'false');
+
+ await page.locator('[data-doc-panel-toggle]').click();
+ await expect(page.locator('[data-doc-panel-toggle]')).toHaveAttribute('aria-expanded', 'true');
+ await expect(docPanelHandle).toHaveAttribute('tabindex', '0');
+ });
+
test('QA-013: focus inside left sidebar → narrow → focus on trigger (FR-9)', async ({
page,
api,
diff --git a/packages/app/vite.config.ts b/packages/app/vite.config.ts
index f8f1397d5..6d4e16553 100644
--- a/packages/app/vite.config.ts
+++ b/packages/app/vite.config.ts
@@ -35,7 +35,7 @@ export default defineConfig({
port: vitePort ?? 5173,
strictPort: vitePort !== undefined,
watch: {
- ignored: ['**/content/**'],
+ ignored: ['**/content/**', '**/playwright-report/**', '**/test-results/**'],
},
},
build: {
diff --git a/packages/desktop/electron.vite.config.ts b/packages/desktop/electron.vite.config.ts
index b71eef6bc..fb94c7079 100644
--- a/packages/desktop/electron.vite.config.ts
+++ b/packages/desktop/electron.vite.config.ts
@@ -64,7 +64,7 @@ export default defineConfig({
},
server: {
watch: {
- ignored: ['**/content/**'],
+ ignored: ['**/content/**', '**/playwright-report/**', '**/test-results/**'],
},
},
},