Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Place Hide Files before the Windows File menu (#3160)

mike-inkeep55bf3c629c3c
diff --git a/packages/app/src/components/EditorHeader.dom.test.tsx b/packages/app/src/components/EditorHeader.dom.test.tsx
index 4dc89a9ea..02e00b056 100644
--- a/packages/app/src/components/EditorHeader.dom.test.tsx
+++ b/packages/app/src/components/EditorHeader.dom.test.tsx
@@ -45,6 +45,10 @@ vi.doMock('@/components/ui/sidebar', () => ({
),
}));
+vi.doMock('@/components/AppMenubar', () => ({
+ AppMenubar: () => <div data-testid="app-menubar" />,
+}));
+
vi.doMock('./EditorTabs', () => ({
EditorTabs: () => <div data-testid="editor-tabs" />,
}));
@@ -93,6 +97,13 @@ function setElectronHost(enabled: boolean) {
});
}
+function setWindowsHost() {
+ Object.defineProperty(window, 'okDesktop', {
+ configurable: true,
+ value: { menu: {}, platform: 'win32' },
+ });
+}
+
async function renderHeader() {
const { EditorHeader } = await import('./EditorHeader');
render(
@@ -232,6 +243,30 @@ describe('EditorHeader runtime behavior', () => {
expect(screen.queryByTestId('navigation-history-controls')).toBeNull();
});
+ test('Windows places Hide Files before the File menu', async () => {
+ setWindowsHost();
+ const header = await renderHeader();
+
+ const files = screen.getByTestId('sidebar-trigger');
+ const menubar = await screen.findByTestId('app-menubar');
+ const leftZone = header.children.item(0) as HTMLElement;
+ const separator = leftZone.querySelector('[data-slot="separator"]') as HTMLElement;
+
+ expect(files.compareDocumentPosition(menubar) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ expect(
+ menubar.compareDocumentPosition(separator) & Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ });
+
+ test('Windows single-file mode keeps the menubar without project chrome', async () => {
+ setWindowsHost();
+ singleFile = true;
+ await renderHeader();
+
+ expect(await screen.findByTestId('app-menubar')).toBeTruthy();
+ expect(screen.queryByTestId('sidebar-trigger')).toBeNull();
+ });
+
test('rail drag keeps the reserve but drops the padding transition so it snaps with the sidebar', async () => {
// During a rail drag the sidebar group runs duration-0 and collapses
// instantly; an animated reserve would lag behind and park the
diff --git a/packages/app/src/components/EditorHeader.tsx b/packages/app/src/components/EditorHeader.tsx
index 6c68d04d0..9427ec15a 100644
--- a/packages/app/src/components/EditorHeader.tsx
+++ b/packages/app/src/components/EditorHeader.tsx
@@ -95,6 +95,11 @@ export function EditorHeader({ onSignIn, onSetIdentity, onOpenSearch }: EditorHe
// place; the `,1rem` fallback is the precedent-#49 safe form. The padding
// transition (and its drag-snap exception) is documented at the className.
const isCollapsed = sidebarState === 'collapsed';
+ const appMenubar = shouldShowAppMenubar() ? (
+ <Suspense fallback={null}>
+ <AppMenubar />
+ </Suspense>
+ ) : null;
return (
<header
@@ -129,14 +134,10 @@ export function EditorHeader({ onSignIn, onSetIdentity, onOpenSearch }: EditorHe
empty in single-file mode. The flex-1 container stays so the right
zone keeps its position and the window-drag spacer is preserved. */}
<div className="flex min-w-0 flex-1 items-center gap-1 px-3">
- {/* Windows/Linux custom menubar (windows-linux-port renderer menubar) — heads the chrome row, VS Code
- style. Renders on every window kind (incl. single-file: Window /
- Help / Exit stay reachable); null on darwin + web. */}
- {shouldShowAppMenubar() && (
- <Suspense fallback={null}>
- <AppMenubar />
- </Suspense>
- )}
+ {/* The menubar renders in single-file windows too: the project-chrome
+ group below is absent there, so without this slot Window / Help /
+ Exit would have no reachable surface at all. */}
+ {singleFile && appMenubar}
{!singleFile && (
<>
<ButtonGroup
@@ -185,6 +186,9 @@ export function EditorHeader({ onSignIn, onSetIdentity, onOpenSearch }: EditorHe
)}
{isElectronHost && isCollapsed && <NavigationHistoryControls />}
</ButtonGroup>
+ {/* Windows/Linux custom menubar follows the Files control in the
+ chrome row; null on darwin + web. */}
+ {appMenubar}
<Separator
orientation="vertical"
className="mr-1 h-4 shrink-0 data-vertical:self-center"