Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Add back and forward navigation to OpenKnowledge (#2874)

Dimitri POSTOLOVe38b7fd87bd4
diff --git a/.changeset/navigation-history-controls.md b/.changeset/navigation-history-controls.md
new file mode 100644
index 000000000..e63d200d5
--- /dev/null
+++ b/.changeset/navigation-history-controls.md
@@ -0,0 +1,12 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Add `Back` and `Forward` navigation to Open Knowledge Desktop's expanded
+sidebar, collapsed title bar, `View` menu, command palette, and platform
+shortcuts. Opening files, folders, assets, or skill files now adds an entry to
+the navigation history, while history traversal reuses the active tab.
+
+Move file-tree actions beside the project root, improve shortcut hints and
+navigation grouping, and fix `Cmd/Ctrl+Shift+N` so New folder no longer opens
+the New file dialog.
diff --git a/packages/app/package.json b/packages/app/package.json
index 8c32f53bf..95a0932fd 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -26,7 +26,7 @@
"measure:fuzz": "bash scripts/measure-fuzz.sh",
"measure:stress": "bash scripts/measure-stress.sh",
"perf:compare": "bash scripts/perf-compare.sh",
- "test:e2e": "playwright test tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts tests/stress/chip-popover-positioning.e2e.ts tests/stress/docs-open-scroll-restore.e2e.ts tests/stress/file-tree-decoration-chip-strip-repro.e2e.ts tests/stress/grip-click-nodeselect.e2e.ts tests/stress/jsx-halo-semantics.e2e.ts tests/stress/jsx-image-body-click.e2e.ts tests/stress/jsx-prop-panel-placeholder.e2e.ts tests/stress/jsx-range-encompass-halo.e2e.ts tests/stress/jsx-wildcard-convert.e2e.ts tests/stress/markdown-lint.e2e.ts tests/stress/unified-problems.e2e.ts tests/stress/mid-type-recovery.e2e.ts tests/stress/observer-a-multi-client.e2e.ts tests/stress/outline-toolbar-occlusion.e2e.ts tests/stress/quiet-tree-hidden-doc.e2e.ts tests/stress/raw-mdx-fallback-onblur-upgrade.e2e.ts tests/stress/rename-noext-probe.e2e.ts tests/stress/show-ok-folders.e2e.ts tests/stress/source-polish.e2e.ts tests/stress/warm-skeleton-scroll-restore.e2e.ts tests/stress/props-toggle-scroll-preserve.e2e.ts tests/stress/yjs-no-dual-import.e2e.ts tests/stress/slash-command-auto-open.e2e.ts tests/stress/graph-panel-surfaces.e2e.ts tests/stress/clipboard-relative-url-source-fallback.e2e.ts tests/stress/asset-embed-real-fidelity.e2e.ts tests/stress/prop-upload.e2e.ts tests/stress/rename-content-preservation.e2e.ts tests/stress/rename-consolidation.e2e.ts tests/stress/outline-navigation.e2e.ts tests/stress/clipboard-dollar-math-source-fallback.e2e.ts",
+ "test:e2e": "playwright test tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/navigation-history.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts tests/stress/chip-popover-positioning.e2e.ts tests/stress/docs-open-scroll-restore.e2e.ts tests/stress/file-tree-decoration-chip-strip-repro.e2e.ts tests/stress/grip-click-nodeselect.e2e.ts tests/stress/jsx-halo-semantics.e2e.ts tests/stress/jsx-image-body-click.e2e.ts tests/stress/jsx-prop-panel-placeholder.e2e.ts tests/stress/jsx-range-encompass-halo.e2e.ts tests/stress/jsx-wildcard-convert.e2e.ts tests/stress/markdown-lint.e2e.ts tests/stress/unified-problems.e2e.ts tests/stress/mid-type-recovery.e2e.ts tests/stress/observer-a-multi-client.e2e.ts tests/stress/outline-toolbar-occlusion.e2e.ts tests/stress/quiet-tree-hidden-doc.e2e.ts tests/stress/raw-mdx-fallback-onblur-upgrade.e2e.ts tests/stress/rename-noext-probe.e2e.ts tests/stress/show-ok-folders.e2e.ts tests/stress/source-polish.e2e.ts tests/stress/warm-skeleton-scroll-restore.e2e.ts tests/stress/props-toggle-scroll-preserve.e2e.ts tests/stress/yjs-no-dual-import.e2e.ts tests/stress/slash-command-auto-open.e2e.ts tests/stress/graph-panel-surfaces.e2e.ts tests/stress/clipboard-relative-url-source-fallback.e2e.ts tests/stress/asset-embed-real-fidelity.e2e.ts tests/stress/prop-upload.e2e.ts tests/stress/rename-content-preservation.e2e.ts tests/stress/rename-consolidation.e2e.ts tests/stress/outline-navigation.e2e.ts tests/stress/clipboard-dollar-math-source-fallback.e2e.ts",
"test:e2e:install-browsers": "playwright install chromium webkit firefox",
"test:visual": "playwright test --config playwright.visual.config.ts",
"test:visual:update": "playwright test --config playwright.visual.config.ts --update-snapshots",
diff --git a/packages/app/src/App.dom.test.tsx b/packages/app/src/App.dom.test.tsx
index b28d05559..61d53c4e7 100644
--- a/packages/app/src/App.dom.test.tsx
+++ b/packages/app/src/App.dom.test.tsx
@@ -1,6 +1,12 @@
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
import type { ReactNode } from 'react';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
+import { pushHashWithoutNavigation } from '@/lib/doc-hash';
+import { matchesKeyboardShortcut, type ShortcutEventLike } from '@/lib/keyboard-shortcuts';
+import {
+ __resetLocalMenuActionBusForTests,
+ emitLocalMenuAction,
+} from '@/lib/local-menu-action-bus';
import { expectVisualClassTokens } from '@/test-utils/visual-contract';
type NavigationTarget =
@@ -35,7 +41,9 @@ let fetchApiConfigMock = vi.fn(() =>
);
let clearTargetMock = vi.fn(() => {});
let syncOpenTabsWithKnownTargetsMock = vi.fn(() => {});
-let openTargetTransitionMock = vi.fn((_: NavigationTarget) => {});
+let openTargetTransitionMock = vi.fn(
+ (_: NavigationTarget, _options?: { tabBehavior?: 'append' | 'replace-active' }) => {},
+);
let resolveNavigationTargetMock = vi.fn(
(docName: string): NavigationTarget => ({ kind: 'doc', target: docName, docName }),
);
@@ -176,7 +184,8 @@ vi.doMock('@/components/ShareReceiveMissDialog', () => ({
}));
vi.doMock('@/components/NewItemDialog', () => ({
- isNewItemShortcut: () => false,
+ isNewItemShortcut: (event: ShortcutEventLike) =>
+ matchesKeyboardShortcut(event, 'new-item', 'mac'),
NewItemDialog: ({ open, initialDir }: { open: boolean; initialDir: string }) => (
<div data-testid="new-item-dialog" data-open={String(open)} data-initial-dir={initialDir} />
),
@@ -256,6 +265,7 @@ function setHash(hash: string) {
describe('App runtime wiring', () => {
beforeEach(() => {
cleanup();
+ __resetLocalMenuActionBusForTests();
Reflect.deleteProperty(window, 'okDesktop');
setHash('');
activeTarget = null;
@@ -284,7 +294,9 @@ describe('App runtime wiring', () => {
globalThis.fetch = vi.fn(() => Promise.resolve(new Response(null, { status: 204 }))) as never;
clearTargetMock = vi.fn(() => {});
syncOpenTabsWithKnownTargetsMock = vi.fn(() => {});
- openTargetTransitionMock = vi.fn((_: NavigationTarget) => {});
+ openTargetTransitionMock = vi.fn(
+ (_: NavigationTarget, _options?: { tabBehavior?: 'append' | 'replace-active' }) => {},
+ );
resolveNavigationTargetMock = vi.fn(
(docName: string): NavigationTarget => ({ kind: 'doc', target: docName, docName }),
);
@@ -294,6 +306,8 @@ describe('App runtime wiring', () => {
afterEach(() => {
cleanup();
+ __resetLocalMenuActionBusForTests();
+ vi.restoreAllMocks();
});
test('imports and mounts the app shell providers and core surfaces', () => {
@@ -334,6 +348,22 @@ describe('App runtime wiring', () => {
expect(window.location.hash).toBe('#settings');
});
+ test('does not claim Cmd+Shift+N from the desktop new-folder accelerator', () => {
+ renderApp({ bridge: createBridge() });
+
+ const event = new KeyboardEvent('keydown', {
+ key: 'N',
+ metaKey: true,
+ shiftKey: true,
+ bubbles: true,
+ cancelable: true,
+ });
+ fireEvent(window, event);
+
+ expect(event.defaultPrevented).toBe(false);
+ expect(screen.getByTestId('new-item-dialog').getAttribute('data-open')).toBe('false');
+ });
+
test('hash navigation opens the downgraded folder-index target, not the pre-downgrade result', async () => {
const resolved: NavigationTarget = {
kind: 'folder-index',
@@ -380,6 +410,119 @@ describe('App runtime wiring', () => {
expect(resolveNavigationTargetMock).not.toHaveBeenCalled();
});
+ test('navigation-history subscription cleans up before remount and invokes each action once', () => {
+ const back = vi.spyOn(window.history, 'back').mockImplementation(() => {});
+ const forward = vi.spyOn(window.history, 'forward').mockImplementation(() => {});
+ renderApp();
+ cleanup();
+ renderApp();
+
+ emitLocalMenuAction('navigate-back');
+ expect(back).toHaveBeenCalledOnce();
+ expect(forward).not.toHaveBeenCalled();
+
+ emitLocalMenuAction('navigate-forward');
+ expect(back).toHaveBeenCalledOnce();
+ expect(forward).toHaveBeenCalledOnce();
+ });
+
+ test('history traversal reuses the active tab across same-tab page navigation', async () => {
+ setHash('#/page-a');
+ renderApp();
+
+ await waitFor(() => {
+ expect(openTargetTransitionMock).toHaveBeenCalledWith({
+ kind: 'doc',
+ target: 'page-a',
+ docName: 'page-a',
+ });
+ });
+
+ // File-tree navigation opens in the active tab and records the URL with
+ // pushState, so NavigationHandler sees only the later history traversal.
+ pushHashWithoutNavigation('#/page-b');
+ pushHashWithoutNavigation('#/page-c');
+ openTargetTransitionMock.mockClear();
+
+ window.history.back();
+
+ await waitFor(() => {
+ expect(window.location.hash).toBe('#/page-b');
+ expect(openTargetTransitionMock).toHaveBeenCalledWith(
+ {
+ kind: 'doc',
+ target: 'page-b',
+ docName: 'page-b',
+ },
+ { tabBehavior: 'replace-active' },
+ );
+ });
+
+ openTargetTransitionMock.mockClear();
+ window.history.back();
+
+ await waitFor(() => {
+ expect(window.location.hash).toBe('#/page-a');
+ expect(openTargetTransitionMock).toHaveBeenCalledWith(
+ {
+ kind: 'doc',
+ target: 'page-a',
+ docName: 'page-a',
+ },
+ { tabBehavior: 'replace-active' },
+ );
+ });
+
+ openTargetTransitionMock.mockClear();
+ window.history.forward();
+
+ await waitFor(() => {
+ expect(window.location.hash).toBe('#/page-b');
+ expect(openTargetTransitionMock).toHaveBeenCalledWith(
+ {
+ kind: 'doc',
+ target: 'page-b',
+ docName: 'page-b',
+ },
+ { tabBehavior: 'replace-active' },
+ );
+ });
+ });
+
+ test('direct hash navigation preserves the active tab', async () => {
+ setHash('#/page-a');
+ renderApp();
+
+ await waitFor(() => {
+ expect(openTargetTransitionMock).toHaveBeenCalledWith({
+ kind: 'doc',
+ target: 'page-a',
+ docName: 'page-a',
+ });
+ });
+
+ openTargetTransitionMock.mockClear();
+ window.history.pushState(null, '', `${window.location.pathname}#/page-b`);
+ window.dispatchEvent(new PopStateEvent('popstate', { state: null }));
+ window.dispatchEvent(new HashChangeEvent('hashchange'));
+
+ await waitFor(() => {
+ expect(openTargetTransitionMock).toHaveBeenCalledWith({
+ kind: 'doc',
+ target: 'page-b',
+ docName: 'page-b',
+ });
+ });
+ expect(openTargetTransitionMock).not.toHaveBeenCalledWith(
+ {
+ kind: 'doc',
+ target: 'page-b',
+ docName: 'page-b',
+ },
+ { tabBehavior: 'replace-active' },
+ );
+ });
+
test('active doc and folder targets are pushed to the desktop bridge', async () => {
const bridge = createBridge();
activeTarget = { kind: 'doc', target: 'docs/readme', docName: 'docs/readme' };
diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx
index 5701f5c14..020b54145 100644
--- a/packages/app/src/App.tsx
+++ b/packages/app/src/App.tsx
@@ -41,8 +41,12 @@ import {
assetPathFromHash,
docNameFromHash,
isContentRootHash,
+ isManagedHashHistoryState,
+ markCurrentHashHistoryEntry,
+ replaceHashWithoutNavigation,
skillFileFromHash,
} from '@/lib/doc-hash';
+import { subscribeLocalMenuAction } from '@/lib/local-menu-action-bus';
import { mark, ProfilerBoundary } from '@/lib/perf';
import { SingleFileModeProvider, useSingleFileMode } from '@/lib/single-file-mode';
import { useServerKeepalive } from '@/lib/use-server-keepalive';
@@ -141,8 +145,21 @@ function NavigationHandler() {
pagesByBasename,
} = usePageList();
const lastSyncedTargetsSignatureRef = useRef<string | null>(null);
+ // Same-tab navigation records hashes with pushState, which stays silent until
+ // history traversal. Pair popstate with its following hashchange so replay
+ // replaces the active tab instead of taking the hash handler's append path.
+ const historyTraversalUrlRef = useRef<string | null>(null);
const targetsSignature = knownTargetsSignature(pages, folderPaths, assetPaths, filePaths);
+ useEffect(
+ () =>
+ subscribeLocalMenuAction((action) => {
+ if (action === 'navigate-back') window.history.back();
+ if (action === 'navigate-forward') window.history.forward();
+ }),
+ [],
+ );
+
useEffect(() => {
if (
loading ||
@@ -167,7 +184,26 @@ function NavigationHandler() {
useEffect(() => {
onHashChange();
+ function onPopState(event: PopStateEvent) {
+ historyTraversalUrlRef.current = isManagedHashHistoryState(event.state)
+ ? window.location.href
+ : null;
+ }
+
function onHashChange() {
+ const isHistoryTraversal = historyTraversalUrlRef.current === window.location.href;
+ historyTraversalUrlRef.current = null;
+ // Chromium also emits popstate before hashchange for direct hash assignments.
+ // Mark entries after classifying them so only actual history traversal reuses the active tab.
+ markCurrentHashHistoryEntry();
+ const openHashTarget = (target: ResolvedNavigationTarget) => {
+ if (isHistoryTraversal) {
+ openTargetTransition(target, { tabBehavior: 'replace-active' });
+ return;
+ }
+ openTargetTransition(target);
+ };
+
// Overlay-dialog hashes (settings, install) don't replace the
// active document — they portal a Dialog over it. Skipping
// here keeps the editor mounted underneath; without this guard
@@ -182,7 +218,7 @@ function NavigationHandler() {
const assetExt = assetPath.split('.').pop() ?? '';
const mediaKind = mediaKindForSidebarAssetExtension(assetExt);
mark('ok/nav/hash-change', { docName: null, kind: 'asset' });
- openTargetTransition({
+ openHashTarget({
kind: 'asset',
target: assetPath,
assetPath,
@@ -193,7 +229,7 @@ function NavigationHandler() {
const skillFile = skillFileFromHash(window.location.hash);
if (skillFile) {
mark('ok/nav/hash-change', { docName: null, kind: 'skill-file' });
- openTargetTransition({
+ openHashTarget({
kind: 'skill-file',
target: `${skillFile.scope}/${skillFile.name}/${skillFile.path}`,
scope: skillFile.scope,
@@ -210,7 +246,7 @@ function NavigationHandler() {
// sentinel check must run BEFORE the null-docName clear.
if (isContentRootHash(window.location.hash)) {
mark('ok/nav/hash-change', { docName: null, kind: 'folder' });
- openTargetTransition({ kind: 'folder', target: '', folderPath: '' });
+ openHashTarget({ kind: 'folder', target: '', folderPath: '' });
return;
}
const docName = docNameFromHash(window.location.hash);
@@ -237,10 +273,14 @@ function NavigationHandler() {
}
const target = withLargeFileOpenGuard(downgradeFolderIndexForHashNav(resolved), pageMeta);
mark('ok/nav/hash-change', { docName, kind: target.kind });
- openTargetTransition(target);
+ openHashTarget(target);
}
+ window.addEventListener('popstate', onPopState);
window.addEventListener('hashchange', onHashChange);
- return () => window.removeEventListener('hashchange', onHashChange);
+ return () => {
+ window.removeEventListener('popstate', onPopState);
+ window.removeEventListener('hashchange', onHashChange);
+ };
}, [
clearTarget,
folderPaths,
@@ -284,8 +324,7 @@ function InstallInClaudeDesktopTrigger() {
if (!next && window.location.hash === INSTALL_DIALOG_HASH) {
// Clear the fragment so closing doesn't instantly re-open on refresh.
// Uses history.replaceState to avoid adding a history entry.
- const { pathname, search } = window.location;
- window.history.replaceState(null, '', `${pathname}${search}`);
+ replaceHashWithoutNavigation('');
}
}
@@ -404,6 +443,7 @@ function NewItemShortcutHandler() {
metaKey: e.metaKey,
ctrlKey: e.ctrlKey,
altKey: e.altKey,
+ shiftKey: e.shiftKey,
key: e.key,
})
) {
diff --git a/packages/app/src/components/AppMenubar.dom.test.tsx b/packages/app/src/components/AppMenubar.dom.test.tsx
index 47f22309f..3ab9ed7b8 100644
--- a/packages/app/src/components/AppMenubar.dom.test.tsx
+++ b/packages/app/src/components/AppMenubar.dom.test.tsx
@@ -1,16 +1,16 @@
/**
- * DOM test for AppMenubar's Help menu.
+ * DOM tests for AppMenubar's custom Windows/Linux menus.
*
* AppMenubar is the custom-drawn Windows/Linux menu bar; it self-gates on
- * `window.okDesktop` and returns null on darwin, so its Help entries never
- * render during macOS review. These pin the two entries that route to in-app
- * dialogs, asserting the `bridge.menu.dispatch` payload each one sends.
+ * `window.okDesktop` and returns null on darwin. These pin the Help entries
+ * that route to in-app dialogs and the View history rows, including their
+ * ordering, shortcut hints, and `bridge.menu.dispatch` payloads.
*
* Invocation: `pnpm exec vitest run --config vitest.dom.config.ts
* src/components/AppMenubar.dom.test.tsx` from `packages/app/`.
*/
import * as actualLinguiMacro from '@lingui/react/macro';
-import { cleanup, render, screen } from '@testing-library/react';
+import { cleanup, render, screen, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
@@ -33,10 +33,14 @@ function installBridge(platform: string): DispatchMock {
return dispatch;
}
-async function openHelpMenu() {
+async function openMenu(name: string) {
const { AppMenubar } = await import('./AppMenubar');
render(<AppMenubar />);
- await userEvent.click(screen.getByRole('menuitem', { name: 'Help' }));
+ await userEvent.click(screen.getByRole('menuitem', { name }));
+}
+
+async function openHelpMenu() {
+ await openMenu('Help');
}
describe('AppMenubar Help menu', () => {
@@ -56,6 +60,12 @@ describe('AppMenubar Help menu', () => {
expect(container.firstChild).toBeNull();
});
+ test('returns null on the web host', async () => {
+ const { AppMenubar } = await import('./AppMenubar');
+ const { container } = render(<AppMenubar />);
+ expect(container.firstChild).toBeNull();
+ });
+
test('Send feedback dispatches the send-feedback menu action', async () => {
const dispatch = installBridge('win32');
await openHelpMenu();
@@ -85,3 +95,64 @@ describe('AppMenubar Help menu', () => {
expect(screen.getByRole('menuitem', { name: 'OpenKnowledge on GitHub' })).not.toBeNull();
});
});
+
+describe('AppMenubar View navigation history', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ afterEach(() => {
+ cleanup();
+ (window as unknown as { okDesktop?: unknown }).okDesktop = undefined;
+ });
+
+ test('does not add a standalone Go menu on Windows/Linux', async () => {
+ installBridge('linux');
+ const { AppMenubar } = await import('./AppMenubar');
+ render(<AppMenubar />);
+
+ const labels = within(screen.getByTestId('app-menubar'))
+ .getAllByRole('menuitem')
+ .map((item) => item.textContent);
+ expect(labels).toEqual(['File', 'Edit', 'View', 'Window', 'Help']);
+ });
+
+ test('starts View with Back then Forward and Alt-arrow shortcut hints', async () => {
+ installBridge('win32');
+ await openMenu('View');
+
+ const rows = within(screen.getByRole('menu')).getAllByRole('menuitem');
+ expect(rows.slice(0, 2).map((row) => row.textContent)).toEqual([
+ 'BackAlt+Left',
+ 'ForwardAlt+Right',
+ ]);
+ });
+
+ test('dispatches each navigation-history action once', async () => {
+ const dispatch = installBridge('linux');
+ await openMenu('View');
+ expect(dispatch).toHaveBeenCalledTimes(1);
+ expect(dispatch).toHaveBeenCalledWith({ kind: 'query' });
+ dispatch.mockClear();
+
+ await userEvent.click(screen.getByRole('menuitem', { name: /Back/ }));
+ expect(dispatch).toHaveBeenCalledTimes(1);
+ expect(dispatch).toHaveBeenCalledWith({
+ kind: 'menu-action',
+ action: 'navigate-back',
+ });
+ dispatch.mockClear();
+
+ await userEvent.click(screen.getByRole('menuitem', { name: 'View' }));
+ expect(dispatch).toHaveBeenCalledTimes(1);
+ expect(dispatch).toHaveBeenCalledWith({ kind: 'query' });
+ dispatch.mockClear();
+
+ await userEvent.click(screen.getByRole('menuitem', { name: /Forward/ }));
+ expect(dispatch).toHaveBeenCalledTimes(1);
+ expect(dispatch).toHaveBeenCalledWith({
+ kind: 'menu-action',
+ action: 'navigate-forward',
+ });
+ });
+});
diff --git a/packages/app/src/components/AppMenubar.tsx b/packages/app/src/components/AppMenubar.tsx
index b16382320..99626b75d 100644
--- a/packages/app/src/components/AppMenubar.tsx
+++ b/packages/app/src/components/AppMenubar.tsx
@@ -257,6 +257,17 @@ export function AppMenubar() {
<MenubarMenu>
<MenubarTrigger className="px-2 py-1 text-xs font-normal">{t`View`}</MenubarTrigger>
<MenubarContent>
+ <MenubarItem onSelect={() => dispatch({ kind: 'menu-action', action: 'navigate-back' })}>
+ {t`Back`}
+ <MenubarShortcut>Alt+Left</MenubarShortcut>
+ </MenubarItem>
+ <MenubarItem
+ onSelect={() => dispatch({ kind: 'menu-action', action: 'navigate-forward' })}
+ >
+ {t`Forward`}
+ <MenubarShortcut>Alt+Right</MenubarShortcut>
+ </MenubarItem>
+ <MenubarSeparator />
<MenubarItem onSelect={() => dispatch({ kind: 'role', role: 'reload' })}>
{t`Reload`}
</MenubarItem>
diff --git a/packages/app/src/components/CommandPalette.dom.test.tsx b/packages/app/src/components/CommandPalette.dom.test.tsx
index 3e800ce8c..b5a4e10bb 100644
--- a/packages/app/src/components/CommandPalette.dom.test.tsx
+++ b/packages/app/src/components/CommandPalette.dom.test.tsx
@@ -980,6 +980,8 @@ describe('Cmd+K menu-parity backfill', () => {
// Each id-backed backfill row renders under a matching query and emits its
// OkMenuAction id on the bus when selected.
const ID_BACKED: Array<{ testid: string; query: string; id: string }> = [
+ { testid: 'command-palette-navigate-back', query: 'back', id: 'navigate-back' },
+ { testid: 'command-palette-navigate-forward', query: 'forward', id: 'navigate-forward' },
{
testid: 'command-palette-new-from-template',
query: 'new from template',
@@ -1042,6 +1044,18 @@ describe('Cmd+K menu-parity backfill', () => {
});
}
+ test('navigation-history rows expose their native platform shortcuts on desktop', async () => {
+ await renderPalette({ bridge: createBridge() });
+
+ await setQuery('back');
+ expect(screen.getByTestId('command-palette-navigate-back').textContent).toMatch(/⌘ \[|Alt ←/);
+
+ await setQuery('forward');
+ expect(screen.getByTestId('command-palette-navigate-forward').textContent).toMatch(
+ /⌘ \]|Alt →/,
+ );
+ });
+
// Ratchet C completeness: every id classified as a palette command (shared with
// the id-classification ratchet via command-menu-parity.test-helper) must be
// covered by a rendered id-backed row above OR a pre-existing palette surface.
@@ -1153,6 +1167,10 @@ describe('Cmd+K menu-parity backfill', () => {
expect(screen.queryByTestId('command-palette-check-for-updates')).toBeNull();
await setQuery('rename');
expect(screen.queryByTestId('command-palette-rename')).toBeNull();
+ await setQuery('back');
+ expect(screen.queryByTestId('command-palette-navigate-back')).toBeNull();
+ await setQuery('forward');
+ expect(screen.queryByTestId('command-palette-navigate-forward')).toBeNull();
});
test('AC5: the sidebar toggle label reflects view-menu-state', async () => {
diff --git a/packages/app/src/components/CommandPalette.tsx b/packages/app/src/components/CommandPalette.tsx
index 830d0313c..7b7de8193 100644
--- a/packages/app/src/components/CommandPalette.tsx
+++ b/packages/app/src/components/CommandPalette.tsx
@@ -73,6 +73,7 @@ import {
CommandList,
CommandShortcut,
} from '@/components/ui/command';
+import { Kbd } from '@/components/ui/kbd';
import { useDocumentContext } from '@/editor/DocumentContext';
import type { TagSummaryEntry } from '@/editor/extensions/tag-suggestion';
import { useIsEmbedded } from '@/hooks/use-is-embedded';
@@ -83,7 +84,11 @@ import { hashFromDocName } from '@/lib/doc-hash';
import { runWithToast as runWithToastBase } from '@/lib/error-state';
import { openExternalUrl as openExternalUrlViaHost } from '@/lib/external-link';
import { VISIBLE_TARGETS } from '@/lib/handoff/targets';
-import { formatShortcut, matchesKeyboardShortcut } from '@/lib/keyboard-shortcuts';
+import {
+ formatShortcut,
+ formatShortcutLabel,
+ matchesKeyboardShortcut,
+} from '@/lib/keyboard-shortcuts';
import { emitLocalMenuAction } from '@/lib/local-menu-action-bus';
import { useSingleFileMode } from '@/lib/single-file-mode';
import { useWorkspace } from '@/lib/use-workspace';
@@ -246,7 +251,8 @@ function SearchHint({
>
{mode === 'name-only' ? (
<Trans>
- Search matches file names, paths, and folders. Open a file to search its body (⌘F).
+ Search matches file names, paths, and folders. Open a file to search its body{' '}
+ <Kbd aria-label={formatShortcutLabel('find')}>{formatShortcut('find')}</Kbd>.
</Trans>
) : mode === 'truncated' ? (
<Trans>
@@ -1207,10 +1213,13 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
data-testid="command-palette-semantic-submit"
>
{semanticView.submit.kind === 'retry' ? (
- <span className="flex items-center gap-2 text-amber-700 dark:text-amber-400">
+ <>
<Sparkles />
- <Trans>Couldn't reach the embeddings provider — press ↵ to retry</Trans>
- </span>
+ <span className="min-w-0 flex-1 truncate text-amber-700 dark:text-amber-400">
+ <Trans>Couldn't reach the embeddings provider — retry</Trans>
+ </span>
+ <CommandShortcut>↵</CommandShortcut>
+ </>
) : (
<>
<Sparkles />
@@ -1226,7 +1235,10 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
{semanticView.notice === 'empty' ? (
<CommandEmpty data-testid="command-palette-semantic-empty">
- <Trans>Type a query, then press ↵ to search your pages by meaning.</Trans>
+ <Trans>
+ Type a query, then press <Kbd aria-label={t`Enter`}>↵</Kbd> to search your pages
+ by meaning.
+ </Trans>
</CommandEmpty>
) : null}
{semanticView.notice === 'searching' ? (
@@ -1311,7 +1323,10 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
) : null}
{tagsListStatus === 'error' ? (
<CommandEmpty>
- <Trans>Failed to load tags. Press Escape and re-open to retry.</Trans>
+ <Trans>
+ Failed to load tags. Press <Kbd aria-label={t`Escape`}>Esc</Kbd> and re-open to
+ retry.
+ </Trans>
</CommandEmpty>
) : null}
{showTagListEmpty ? (
@@ -1347,7 +1362,10 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal
) : null}
{tagDocsStatus === 'error' ? (
<CommandEmpty>
- <Trans>Failed to load docs. Press Escape and re-open to retry.</Trans>
+ <Trans>
+ Failed to load docs. Press <Kbd aria-label={t`Escape`}>Esc</Kbd> and re-open to
+ retry.
+ </Trans>
</CommandEmpty>
) : null}
{showTagDocsEmpty ? (
diff --git a/packages/app/src/components/EditorHeader.dom.test.tsx b/packages/app/src/components/EditorHeader.dom.test.tsx
index 3643d5b08..4dc89a9ea 100644
--- a/packages/app/src/components/EditorHeader.dom.test.tsx
+++ b/packages/app/src/components/EditorHeader.dom.test.tsx
@@ -1,8 +1,10 @@
import * as actualLinguiMacro from '@lingui/react/macro';
import { cleanup, render, screen } from '@testing-library/react';
-import type { ReactNode } from 'react';
+import userEvent from '@testing-library/user-event';
+import type { ComponentProps, ReactNode } from 'react';
import { afterEach, describe, expect, test, vi } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
+import { formatShortcut, formatShortcutLabel } from '@/lib/keyboard-shortcuts';
import {
expectVisualClassTokens,
expectVisualClassTokensAbsent,
@@ -21,17 +23,23 @@ let activeDocName: string | null = 'docs/notes';
let activeTarget: unknown = { kind: 'doc' };
let sidebarState: 'expanded' | 'collapsed' = 'expanded';
let isDraggingRail = false;
+let singleFile = false;
// Captures the `input` prop EditorHeader hands to ShareButton.
let lastShareInput: unknown;
+const onOpenSearch = vi.fn(() => {});
vi.doMock('@/editor/DocumentContext', () => ({
useDocumentContext: () => ({ activeDocName, activeTarget }),
}));
+vi.doMock('@/lib/single-file-mode', () => ({
+ useSingleFileMode: () => singleFile,
+}));
+
vi.doMock('@/components/ui/sidebar', () => ({
useSidebar: () => ({ state: sidebarState, isDraggingRail }),
- SidebarTrigger: ({ className }: { className?: string }) => (
- <button type="button" data-testid="sidebar-trigger" className={className}>
+ SidebarTrigger: ({ className, ...props }: ComponentProps<'button'>) => (
+ <button type="button" data-testid="sidebar-trigger" className={className} {...props}>
sidebar
</button>
),
@@ -88,8 +96,8 @@ function setElectronHost(enabled: boolean) {
async function renderHeader() {
const { EditorHeader } = await import('./EditorHeader');
render(
- <TooltipProvider>
- <EditorHeader />
+ <TooltipProvider delayDuration={0}>
+ <EditorHeader onOpenSearch={onOpenSearch} />
</TooltipProvider>,
);
return document.querySelector('header') as HTMLElement;
@@ -103,7 +111,9 @@ describe('EditorHeader runtime behavior', () => {
activeTarget = { kind: 'doc' };
sidebarState = 'expanded';
isDraggingRail = false;
+ singleFile = false;
lastShareInput = undefined;
+ onOpenSearch.mockClear();
});
test('exports the EditorHeader component', async () => {
@@ -131,9 +141,52 @@ describe('EditorHeader runtime behavior', () => {
expectVisualClassTokensAbsent(screen.getByTestId('sidebar-trigger').className, [
'[-webkit-app-region:no-drag]',
]);
+ expect(screen.queryByTestId('navigation-history-controls')).toBeNull();
+ });
+
+ test('renders the expanded Files shortcut as a Kbd keycap', async () => {
+ const user = userEvent.setup();
+ await renderHeader();
+
+ await user.hover(screen.getByTestId('sidebar-trigger'));
+ const tooltip = await screen.findByRole('tooltip', {
+ name: `Hide Files ${formatShortcutLabel('toggle-files-sidebar')}`,
+ });
+ expect(tooltip.querySelector('[data-slot="kbd"]')?.textContent).toBe(
+ formatShortcut('toggle-files-sidebar'),
+ );
});
- test('Electron collapsed-sidebar host enables drag region and traffic-light reserve', async () => {
+ test('renders collapsed Files and Search shortcuts as Kbd keycaps with spoken button text', async () => {
+ const user = userEvent.setup();
+ sidebarState = 'collapsed';
+ await renderHeader();
+
+ const filesButton = screen.getByTestId('sidebar-trigger');
+ await user.hover(filesButton);
+ const filesTooltip = await screen.findByRole('tooltip', {
+ name: `Show Files ${formatShortcutLabel('toggle-files-sidebar')}`,
+ });
+ expect(filesTooltip.querySelector('[data-slot="kbd"]')?.textContent).toBe(
+ formatShortcut('toggle-files-sidebar'),
+ );
+ cleanup();
+ await renderHeader();
+
+ const searchButton = screen.getByRole('button', {
+ name: `Search (${formatShortcutLabel('command-palette')})`,
+ });
+ await user.hover(searchButton);
+ const searchTooltip = await screen.findByRole('tooltip', {
+ name: `Search ${formatShortcutLabel('command-palette')}`,
+ });
+ expect(searchTooltip.querySelector('[data-slot="kbd"]')?.textContent).toBe(
+ formatShortcut('command-palette'),
+ );
+ expect(searchButton).not.toBeNull();
+ });
+
+ test('Electron collapsed-sidebar host groups workspace navigation without a Search-to-Back separator', async () => {
setElectronHost(true);
sidebarState = 'collapsed';
const header = await renderHeader();
@@ -147,8 +200,26 @@ describe('EditorHeader runtime behavior', () => {
expectVisualClassTokens(screen.getByTestId('sidebar-trigger').className, [
'[-webkit-app-region:no-drag]',
]);
+ const leftZone = header.children.item(0) as HTMLElement;
+ const workspaceNavigation = screen.getByRole('group', { name: 'Workspace navigation' });
+ const search = screen.getByRole('button', { name: /^Search/ });
+ const navigation = screen.getByTestId('navigation-history-controls');
+ const separator = leftZone.querySelector('[data-slot="separator"]') as HTMLElement;
+ expect(workspaceNavigation.contains(screen.getByTestId('sidebar-trigger'))).toBe(true);
+ expect(workspaceNavigation.contains(search)).toBe(true);
+ expect(workspaceNavigation.contains(navigation)).toBe(true);
+ expect(workspaceNavigation.querySelector('[data-slot="button-group-separator"]')).toBeNull();
+ expect(screen.getAllByRole('button', { name: 'Back' })).toHaveLength(1);
+ expect(screen.getAllByRole('button', { name: 'Forward' })).toHaveLength(1);
+ expect(
+ search.compareDocumentPosition(navigation) & Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ expect(
+ navigation.compareDocumentPosition(separator) & Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ expectVisualClassTokens(navigation.className, ['[-webkit-app-region:no-drag]']);
const rightZone = header.children.item(1) as HTMLElement;
- expectVisualClassTokens(rightZone.className, ['[&>*]:[-webkit-app-region:no-drag]']);
+ expectVisualClassTokens(rightZone.className, ['*:[-webkit-app-region:no-drag]']);
});
test('Electron expanded sidebar keeps drag region but does not reserve traffic-light padding', async () => {
@@ -158,6 +229,7 @@ describe('EditorHeader runtime behavior', () => {
expectVisualClassTokens(header.className, ['[-webkit-app-region:drag]']);
expectVisualClassTokensAbsent(header.className, ['pl-[var(--ok-titlebar-reserve-left,1rem)]']);
+ expect(screen.queryByTestId('navigation-history-controls')).toBeNull();
});
test('rail drag keeps the reserve but drops the padding transition so it snaps with the sidebar', async () => {
@@ -174,6 +246,17 @@ describe('EditorHeader runtime behavior', () => {
expectVisualClassTokensAbsent(header.className, ['motion-safe:transition-[padding]']);
});
+ test('single-file mode omits collapsed navigation history with the rest of project chrome', async () => {
+ setElectronHost(true);
+ sidebarState = 'collapsed';
+ singleFile = true;
+ await renderHeader();
+
+ expect(screen.queryByTestId('sidebar-trigger')).toBeNull();
+ expect(screen.queryByRole('button', { name: /^Search/ })).toBeNull();
+ expect(screen.queryByTestId('navigation-history-controls')).toBeNull();
+ });
+
test('renders tabs and action cluster without project or asset-title chrome', async () => {
await renderHeader();
diff --git a/packages/app/src/components/EditorHeader.tsx b/packages/app/src/components/EditorHeader.tsx
index 3a972daf9..4581bc7e8 100644
--- a/packages/app/src/components/EditorHeader.tsx
+++ b/packages/app/src/components/EditorHeader.tsx
@@ -1,14 +1,16 @@
import { parseManagedArtifactName } from '@inkeep/open-knowledge-core';
-import { Trans, useLingui } from '@lingui/react/macro';
+import { useLingui } from '@lingui/react/macro';
import { Search } from 'lucide-react';
import { lazy, Suspense, useState } from 'react';
import { shouldShowAppMenubar } from '@/components/app-menubar-gate';
import { Button } from '@/components/ui/button';
+import { ButtonGroup } from '@/components/ui/button-group';
+import { Kbd } from '@/components/ui/kbd';
import { Separator } from '@/components/ui/separator';
import { SidebarTrigger, useSidebar } from '@/components/ui/sidebar';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { useDocumentContext } from '@/editor/DocumentContext';
-import { formatShortcut } from '@/lib/keyboard-shortcuts';
+import { formatShortcut, formatShortcutLabel } from '@/lib/keyboard-shortcuts';
import {
buildDocShareInput,
buildFolderShareInput,
@@ -21,6 +23,7 @@ import { BetaBadge } from './BetaBadge';
import { EditorTabs } from './EditorTabs';
import { HelpPopover } from './HelpPopover';
import { InstanceBadge } from './InstanceBadge';
+import { NavigationHistoryControls } from './NavigationHistoryControls';
import { PublishToGitHubDialog } from './PublishToGitHubDialog';
import { SettingsButton } from './SettingsButton';
import { ShareButton } from './ShareButton';
@@ -53,7 +56,9 @@ export function EditorHeader({ onSignIn, onSetIdentity, onOpenSearch }: EditorHe
// doc-scoped actions (Share / sync / agent handoff) intact.
const singleFile = useSingleFileMode();
const sidebarShortcut = formatShortcut('toggle-files-sidebar');
+ const sidebarShortcutLabel = formatShortcutLabel('toggle-files-sidebar');
const searchShortcut = formatShortcut('command-palette');
+ const searchShortcutLabel = formatShortcutLabel('command-palette');
const [publishOpen, setPublishOpen] = useState(false);
// Share input for the header button: folder → folder-scope, doc → doc-scope,
// empty editor → project root; non-shareable surfaces yield null (disabled).
@@ -134,45 +139,52 @@ export function EditorHeader({ onSignIn, onSetIdentity, onOpenSearch }: EditorHe
)}
{!singleFile && (
<>
- <Tooltip>
- <TooltipTrigger asChild>
- <SidebarTrigger
- className={cn(
- '-ml-1 shrink-0 text-muted-foreground',
- isElectronHost && '[-webkit-app-region:no-drag]',
- )}
- />
- </TooltipTrigger>
- <TooltipContent>
- {sidebarState === 'expanded' ? (
- <Trans>Hide Files ({sidebarShortcut})</Trans>
- ) : (
- <Trans>Show Files ({sidebarShortcut})</Trans>
- )}
- </TooltipContent>
- </Tooltip>
- {isCollapsed && onOpenSearch && (
+ <ButtonGroup
+ aria-label={t`Workspace navigation`}
+ className={cn(
+ '-ml-1 shrink-0 has-[>[data-slot=button-group]]:gap-0',
+ isElectronHost && '[-webkit-app-region:no-drag]',
+ )}
+ >
<Tooltip>
<TooltipTrigger asChild>
- <Button
- variant="ghost"
- size="icon-sm"
- onClick={onOpenSearch}
- aria-label={t`Search (${searchShortcut})`}
- data-telemetry-event="ok.editor_header.search.click"
+ <SidebarTrigger
className={cn(
'shrink-0 text-muted-foreground',
isElectronHost && '[-webkit-app-region:no-drag]',
)}
- >
- <Search aria-hidden="true" />
- </Button>
+ />
</TooltipTrigger>
<TooltipContent>
- <Trans>Search ({searchShortcut})</Trans>
+ <span>{sidebarState === 'expanded' ? t`Hide Files` : t`Show Files`}</span>{' '}
+ <Kbd aria-label={sidebarShortcutLabel}>{sidebarShortcut}</Kbd>
</TooltipContent>
</Tooltip>
- )}
+ {isCollapsed && onOpenSearch && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={onOpenSearch}
+ aria-label={t`Search (${searchShortcutLabel})`}
+ data-telemetry-event="ok.editor_header.search.click"
+ className={cn(
+ 'shrink-0 text-muted-foreground',
+ isElectronHost && '[-webkit-app-region:no-drag]',
+ )}
+ >
+ <Search aria-hidden="true" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <span>{t`Search`}</span>{' '}
+ <Kbd aria-label={searchShortcutLabel}>{searchShortcut}</Kbd>
+ </TooltipContent>
+ </Tooltip>
+ )}
+ {isElectronHost && isCollapsed && <NavigationHistoryControls />}
+ </ButtonGroup>
<Separator
orientation="vertical"
className="mr-1 h-4 shrink-0 data-vertical:self-center"
@@ -191,7 +203,7 @@ export function EditorHeader({ onSignIn, onSetIdentity, onOpenSearch }: EditorHe
// HelpPopover (and the visual Separator) fire their handlers instead
// of initiating a window drag. Each consumer uses Radix asChild so
// the rendered DOM root is a single direct child of this zone.
- isElectronHost && '[&>*]:[-webkit-app-region:no-drag]',
+ isElectronHost && '*:[-webkit-app-region:no-drag]',
// Windows/Linux: the OS window controls float over the top-right
// of this row (titleBarOverlay). --ok-titlebar-reserve-right is
// non-zero only under electron-platform-win32/linux (see
diff --git a/packages/app/src/components/EditorToolbar.dom.test.tsx b/packages/app/src/components/EditorToolbar.dom.test.tsx
index e7cf86940..5d3e9412c 100644
--- a/packages/app/src/components/EditorToolbar.dom.test.tsx
+++ b/packages/app/src/components/EditorToolbar.dom.test.tsx
@@ -1,8 +1,10 @@
import * as actualLinguiMacro from '@lingui/react/macro';
import { cleanup, render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import type { ReactNode } from 'react';
import { afterEach, describe, expect, test, vi } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
+import { formatShortcut, formatShortcutLabel } from '@/lib/keyboard-shortcuts';
import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
import { expectVisualClassTokens } from '@/test-utils/visual-contract';
@@ -79,6 +81,23 @@ describe('EditorToolbar runtime layout', () => {
expect(middleCell).toBeTruthy();
});
+ test('renders the document-panel shortcut as a Kbd keycap', async () => {
+ const user = userEvent.setup();
+ await renderToolbar();
+
+ await user.hover(
+ screen.getByRole('button', {
+ name: `Hide panel (${formatShortcutLabel('toggle-document-panel')})`,
+ }),
+ );
+ const tooltip = await screen.findByRole('tooltip', {
+ name: `Hide panel ${formatShortcutLabel('toggle-document-panel')}`,
+ });
+ expect(tooltip.querySelector('[data-slot="kbd"]')?.textContent).toBe(
+ formatShortcut('toggle-document-panel'),
+ );
+ });
+
test('a tree-hidden doc gets the not-in-sidebar indicator beside the breadcrumb', async () => {
await renderToolbar('.scratch/hidden-note');
diff --git a/packages/app/src/components/EditorToolbar.tsx b/packages/app/src/components/EditorToolbar.tsx
index dfb6a333f..1e4ed4fc4 100644
--- a/packages/app/src/components/EditorToolbar.tsx
+++ b/packages/app/src/components/EditorToolbar.tsx
@@ -3,6 +3,7 @@ import { Trans, useLingui } from '@lingui/react/macro';
import { ListPlus, PanelRightClose, PanelRightOpen } from 'lucide-react';
import { lazy, Suspense } from 'react';
import { Button } from '@/components/ui/button.tsx';
+import { Kbd } from '@/components/ui/kbd';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import type { EditorModeValue } from '@/editor/use-editor-mode.ts';
import { formatShortcut, formatShortcutLabel } from '@/lib/keyboard-shortcuts';
@@ -173,11 +174,8 @@ export function EditorToolbar({
</TooltipTrigger>
</Button>
<TooltipContent side="bottom">
- {isPanelCollapsed ? (
- <Trans>Show panel ({panelShortcut})</Trans>
- ) : (
- <Trans>Hide panel ({panelShortcut})</Trans>
- )}
+ <span>{isPanelCollapsed ? t`Show panel` : t`Hide panel`}</span>{' '}
+ <Kbd aria-label={panelShortcutLabel}>{panelShortcut}</Kbd>
</TooltipContent>
</Tooltip>
</div>
diff --git a/packages/app/src/components/FileSidebar.dom.test.tsx b/packages/app/src/components/FileSidebar.dom.test.tsx
index 23f9b84bb..1c9e06608 100644
--- a/packages/app/src/components/FileSidebar.dom.test.tsx
+++ b/packages/app/src/components/FileSidebar.dom.test.tsx
@@ -1,7 +1,16 @@
import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
-import { type MouseEventHandler, type ReactNode, useEffect } from 'react';
+import userEvent from '@testing-library/user-event';
+import {
+ cloneElement,
+ isValidElement,
+ type MouseEventHandler,
+ type ReactElement,
+ type ReactNode,
+ useEffect,
+} from 'react';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
+import { formatShortcut, formatShortcutLabel } from '@/lib/keyboard-shortcuts';
import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
import {
expectVisualClassTokens,
@@ -12,6 +21,19 @@ function PassThrough({ children }: { children?: ReactNode }) {
return <>{children}</>;
}
+function TriggerPassThrough({
+ children,
+ asChild: _asChild,
+ ...props
+}: {
+ children?: ReactNode;
+ asChild?: boolean;
+ [key: string]: unknown;
+}) {
+ if (!isValidElement(children)) return children;
+ return cloneElement(children as ReactElement<Record<string, unknown>>, props);
+}
+
function ElementPassThrough({
children,
asChild: _asChild,
@@ -321,7 +343,7 @@ vi.doMock('@/components/ui/dropdown-menu', () => ({
DropdownMenuItem: Button,
DropdownMenuLabel: ({ children }: { children?: ReactNode }) => <div>{children}</div>,
DropdownMenuSeparator: () => <hr data-testid="dropdown-menu-separator" />,
- DropdownMenuTrigger: PassThrough,
+ DropdownMenuTrigger: TriggerPassThrough,
}));
vi.doMock('@/components/ui/sidebar', () => ({
@@ -420,7 +442,9 @@ vi.doMock('sonner', () => ({
async function renderSidebar() {
const { FileSidebar } = await import('./FileSidebar');
- return render(<FileSidebar onOpenSearch={onOpenSearch} />, { wrapper: TooltipProvider });
+ return render(<FileSidebar onOpenSearch={onOpenSearch} />, {
+ wrapper: ({ children }) => <TooltipProvider delayDuration={0}>{children}</TooltipProvider>,
+ });
}
describe('FileSidebar runtime behavior', () => {
@@ -474,11 +498,13 @@ describe('FileSidebar runtime behavior', () => {
});
});
- test('web mode keeps the Files label, spread toolbar layout, search entry, and no Electron chrome classes', async () => {
+ test('web mode keeps only the Files label in the header and omits navigation history', async () => {
await renderSidebar();
const header = screen.getByTestId('sidebar-header');
expect(screen.getByText('Files')).toBeTruthy();
+ expect(header.children).toHaveLength(1);
+ expect(screen.queryByTestId('navigation-history-controls')).toBeNull();
expectVisualClassTokens(header.className, ['justify-between']);
expectVisualClassTokensAbsent(header.className, [
'[-webkit-app-region:drag]',
@@ -493,7 +519,8 @@ describe('FileSidebar runtime behavior', () => {
expect(onOpenSearch).toHaveBeenCalledTimes(1);
});
- test('Electron mode moves identity to the footer and applies drag/no-drag chrome treatment', async () => {
+ test('expanded Electron header contains only the traffic-light reserve and one navigation pair', async () => {
+ const user = userEvent.setup();
installBridge();
await renderSidebar();
@@ -520,16 +547,34 @@ describe('FileSidebar runtime behavior', () => {
'shrink-0',
'self-stretch',
]);
- expectVisualClassTokens(toolbar.className, ['[&>*]:[-webkit-app-region:no-drag]']);
+ expectVisualClassTokens(toolbar.className, ['*:[-webkit-app-region:no-drag]']);
expectVisualClassTokens(pillRow.className, ['[-webkit-app-region:no-drag]']);
expect(screen.getByTestId('sidebar-rail').getAttribute('data-enable-toggle')).toBe('false');
+
+ const navigation = screen.getByTestId('navigation-history-controls');
+ expect(header.children).toHaveLength(2);
+ expect(header.children.item(0)).toBe(reserve);
+ expect(header.children.item(1)).toBe(navigation);
+ expect(within(header).getAllByRole('button')).toHaveLength(2);
+ expect(within(header).getByRole('button', { name: 'Back' })).toBeTruthy();
+ expect(within(header).getByRole('button', { name: 'Forward' })).toBeTruthy();
+ expect(header.contains(toolbar)).toBe(false);
+
+ await user.hover(screen.getByRole('button', { name: 'New folder' }));
+ const newFolderTooltip = await screen.findByRole('tooltip', {
+ name: `New folder ${formatShortcutLabel('new-folder')}`,
+ });
+ expect(newFolderTooltip.querySelector('[data-slot="kbd"]')?.textContent).toBe(
+ formatShortcut('new-folder'),
+ );
});
- test('collapsed Electron sidebar fades the toolbar and search pill in lockstep', async () => {
+ test('collapsed Electron sidebar removes navigation and fades the header and search pill in lockstep', async () => {
installBridge();
sidebarState = 'collapsed';
await renderSidebar();
+ expect(screen.queryByTestId('navigation-history-controls')).toBeNull();
expectVisualClassTokens(screen.getByTestId('sidebar-header').className, [
'opacity-0',
'motion-safe:transition-opacity',
@@ -545,6 +590,52 @@ describe('FileSidebar runtime behavior', () => {
]);
});
+ test('project-root label keeps the trigger and four-action toolbar as siblings', async () => {
+ const user = userEvent.setup();
+ await renderSidebar();
+
+ const trigger = document.querySelector('[data-sidebar-root-context]') as HTMLElement;
+ const toolbar = screen.getByTestId('sidebar-toolbar');
+ expect(trigger).toBeTruthy();
+ expect(screen.getByRole('group', { name: 'Files toolbar' })).toBe(toolbar);
+ expect(trigger.parentElement).toBe(toolbar.parentElement);
+ expect(trigger.contains(toolbar)).toBe(false);
+ expectVisualClassTokens(trigger.className, ['min-w-0', 'flex-1']);
+ expect(within(toolbar).getByRole('button', { name: 'Tree view options' })).toBeTruthy();
+ expect(within(toolbar).getByRole('button', { name: 'New file' })).toBeTruthy();
+ expect(within(toolbar).getByRole('button', { name: 'New from template' })).toBeTruthy();
+ expect(within(toolbar).getByRole('button', { name: 'New folder' })).toBeTruthy();
+ for (const label of ['Tree view options', 'New file', 'New from template', 'New folder']) {
+ expectVisualClassTokens(within(toolbar).getByRole('button', { name: label }).className, [
+ "[&_svg:not([class*='size-'])]:size-3.5",
+ ]);
+ }
+
+ await user.hover(within(toolbar).getByRole('button', { name: 'New file' }));
+ const newFileTooltip = await screen.findByRole('tooltip', {
+ name: `New file ${formatShortcutLabel('new-item')}`,
+ });
+ expect(newFileTooltip.querySelector('[data-slot="kbd"]')?.textContent).toBe(
+ formatShortcut('new-item'),
+ );
+ cleanup();
+ await renderSidebar();
+ await user.hover(screen.getByRole('button', { name: 'Tree view options' }));
+ expect(
+ (await screen.findByRole('tooltip', { name: 'Tree view options' })).querySelector(
+ '[data-slot="kbd"]',
+ ),
+ ).toBeNull();
+ cleanup();
+ await renderSidebar();
+ await user.hover(screen.getByRole('button', { name: 'New folder' }));
+ expect(
+ (await screen.findByRole('tooltip', { name: 'New folder' })).querySelector(
+ '[data-slot="kbd"]',
+ ),
+ ).toBeNull();
+ });
+
test('toolbar actions use the active folder while tree-state actions smart-hide no-op menu items', async () => {
await renderSidebar();
await waitFor(() => expect(treeListeners.size).toBe(1));
diff --git a/packages/app/src/components/FileSidebar.tsx b/packages/app/src/components/FileSidebar.tsx
index dbe1d4671..5d0e6a3fb 100644
--- a/packages/app/src/components/FileSidebar.tsx
+++ b/packages/app/src/components/FileSidebar.tsx
@@ -32,6 +32,7 @@ import {
useHandoffDispatch,
} from '@/components/handoff/useHandoffDispatch';
import { useInstalledAgents } from '@/components/handoff/useInstalledAgents';
+import { NavigationHistoryControls } from '@/components/NavigationHistoryControls';
import { OnboardingCardMount } from '@/components/OnboardingCard';
import { ProjectSwitcher } from '@/components/ProjectSwitcher';
import { onPillRenderError, SidebarSearchBar } from '@/components/SidebarSearchBar';
@@ -39,6 +40,7 @@ import { SkillsSidebarSection } from '@/components/SkillsSidebarSection';
import { TemplateMenuRows } from '@/components/template-menu-rows';
import { UpdateNotices } from '@/components/UpdateNotices';
import { Button } from '@/components/ui/button';
+import { ButtonGroup } from '@/components/ui/button-group';
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
import {
ContextMenu,
@@ -61,6 +63,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
+import { Kbd } from '@/components/ui/kbd';
import {
Sidebar,
SidebarContent,
@@ -91,6 +94,11 @@ import {
emitFileTreeMenuActionRename,
} from '@/lib/file-tree-menu-action-events';
import { VISIBLE_TARGETS } from '@/lib/handoff/targets';
+import {
+ formatShortcut,
+ formatShortcutLabel,
+ type KeyboardShortcutId,
+} from '@/lib/keyboard-shortcuts';
import { subscribeLocalMenuAction } from '@/lib/local-menu-action-bus';
import { ProfilerBoundary } from '@/lib/perf';
import { scheduleClipboardWrite } from '@/lib/share/clipboard-adapter';
@@ -145,32 +153,76 @@ export function FileSidebar({ onOpenSearch }: FileSidebarProps) {
interface ToolbarButtonProps extends ComponentProps<typeof Button> {
icon: FC<ComponentProps<'svg'>>;
label: string;
+ shortcutId?: KeyboardShortcutId;
}
-const ToolbarButton: FC<ToolbarButtonProps> = ({ icon: Icon, label, ...props }) => {
+const TOOLBAR_ICON_CLASS_NAME = "[&_svg:not([class*='size-'])]:size-3.5";
+
+const ToolbarTooltipContent: FC<Pick<ToolbarButtonProps, 'label' | 'shortcutId'>> = ({
+ label,
+ shortcutId,
+}) => {
+ return (
+ <TooltipContent>
+ <span>{label}</span>
+ {shortcutId ? (
+ <>
+ {' '}
+ <Kbd aria-label={formatShortcutLabel(shortcutId)}>{formatShortcut(shortcutId)}</Kbd>
+ </>
+ ) : null}
+ </TooltipContent>
+ );
+};
+
+const ToolbarButton: FC<ToolbarButtonProps> = ({
+ className,
+ icon: Icon,
+ label,
+ shortcutId,
+ ...props
+}) => {
return (
<Tooltip>
<TooltipTrigger asChild>
- <Button variant="ghost" size="icon-sm" aria-label={label} {...props}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={label}
+ className={cn(TOOLBAR_ICON_CLASS_NAME, className)}
+ {...props}
+ >
<Icon aria-hidden="true" />
</Button>
</TooltipTrigger>
- <TooltipContent>{label}</TooltipContent>
+ <ToolbarTooltipContent label={label} shortcutId={shortcutId} />
</Tooltip>
);
};
-const ToolbarDropdownTrigger: FC<ToolbarButtonProps> = ({ icon: Icon, label, ...props }) => {
+const ToolbarDropdownTrigger: FC<ToolbarButtonProps> = ({
+ className,
+ icon: Icon,
+ label,
+ shortcutId,
+ ...props
+}) => {
return (
<Tooltip>
<TooltipTrigger asChild>
<DropdownMenuTrigger asChild>
- <Button variant="ghost" size="icon-sm" aria-label={label} {...props}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={label}
+ className={cn(TOOLBAR_ICON_CLASS_NAME, className)}
+ {...props}
+ >
<Icon aria-hidden="true" />
</Button>
</DropdownMenuTrigger>
</TooltipTrigger>
- <TooltipContent>{label}</TooltipContent>
+ <ToolbarTooltipContent label={label} shortcutId={shortcutId} />
</Tooltip>
);
};
@@ -222,10 +274,10 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
// Detection idiom matches OpenInAgentMenu / FileTree / EditorHeader. In
// Electron mode the SidebarFooter's ProjectSwitcher already carries the
- // project's contextual identity, so the SidebarHeader stays minimal — just
- // action buttons on the right, draggable empty space on the left where the
- // traffic lights sit. Web mode keeps the 'Files' section label since there's
- // no ProjectSwitcher and no chrome row to anchor against.
+ // project's contextual identity, so the SidebarHeader stays minimal —
+ // navigation on the right and draggable traffic-light space on the left.
+ // Web mode keeps the 'Files' section label since there's no ProjectSwitcher
+ // and no chrome row to anchor against.
const isElectronHost = typeof window !== 'undefined' && window.okDesktop != null;
// Collapsed sidebar = focus mode: hide the section label so the chrome row
@@ -238,7 +290,7 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
const isExpanded = sidebarState === 'expanded';
const isCollapsed = sidebarState === 'collapsed';
// Single source of truth for the chrome-row opacity gate. Driving both
- // the SidebarHeader's toolbar row AND the sibling pill row off the same
+ // the SidebarHeader's navigation row AND the sibling pill row off the same
// boolean makes the lockstep-fade invariant a structural property
// (one variable, two consumers) instead of a copy-paste relationship
// between the two className blocks. A refactor that wraps one row in
@@ -748,9 +800,9 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
data-electron-drag={isElectronHost ? '' : undefined}
className={cn(
// h-12 matches EditorHeader's height so the OS traffic lights are
- // vertically centered with BOTH toolbars (same midline at y=24px).
+ // vertically centered with both chrome rows (same midline at y=24px).
// Without this, the SidebarHeader's natural shorter height puts
- // its action icons above the EditorHeader's row, and no
+ // its navigation icons above the EditorHeader's row, and no
// trafficLightPosition can align with both at once.
//
// `py-0 px-3` overrides the primitive's inherited `p-2` (8px all
@@ -764,22 +816,16 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
// change since `justify-end` / `justify-between` already control
// horizontal layout).
'flex-row h-12 items-center py-0 px-3',
- // Electron mode has only the action buttons in the header (no
- // 'Files' label, no project name — ProjectSwitcher in the footer
- // carries project identity). `justify-between` pins a
- // non-shrinkable traffic-light reserve (the spacer rendered
- // below) to the left and the action cluster to the right, so the
- // cluster sits AFTER the macOS traffic-light region regardless of
- // how many buttons it holds — the clearance is structural, not a
- // function of MIN_SIDEBAR_WIDTH tuning. `overflow-x-clip` makes an
- // over-budget cluster degrade by clipping toward the sidebar
- // interior instead of sliding left under the OS chrome. Web mode
- // keeps the same spread: 'Files' label flush left, actions right.
+ // Expanded Electron mode has only history navigation in the
+ // header (ProjectSwitcher in the footer carries identity).
+ // `justify-between` pins the traffic-light reserve left and the
+ // navigation pair right, keeping its clearance structural.
+ // Web mode contains only the 'Files' label.
'justify-between',
isElectronHost && 'overflow-x-clip',
// Fade the header content out when the sidebar starts collapsing
// offcanvas. The shadcn primitive slides the entire sidebar left
- // over 200ms; without an opacity gate the action icons would
+ // over 200ms; without an opacity gate the navigation icons would
// visibly cross UNDER the OS-level traffic lights mid-slide
// (renderer content always sits beneath the OS chrome).
//
@@ -824,10 +870,9 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
>
{isElectronHost ? (
// Non-shrinkable macOS traffic-light reserve. With the header's
- // `justify-between` this holds the left edge so the action
- // cluster can never extend under the OS traffic lights, no matter
- // the button count or how narrow the sidebar is dragged — the
- // clearance is structural rather than relying on the
+ // `justify-between` this holds the left edge so the navigation
+ // pair cannot extend under the OS traffic lights — the clearance
+ // is structural rather than relying on the
// MIN_SIDEBAR_WIDTH tuning in `ui/sidebar.tsx`. Decorative and
// draggable (inherits the header drag region); width is the
// shared `--ok-titlebar-reserve-left` token.
@@ -842,142 +887,7 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
<Trans>Files</Trans>
</span>
) : null}
- <div
- data-testid="sidebar-toolbar"
- className={cn(
- 'flex items-center gap-1',
- // Direct-child no-drag opt-out so each toolbar button keeps
- // firing its click handler instead of initiating a window
- // drag — same [&>*] pattern as EditorHeader's right zone.
- // The DropdownMenuTrigger renders via Radix `asChild` so
- // its single direct DOM child (the Button) receives the
- // no-drag class.
- isElectronHost && '[&>*]:[-webkit-app-region:no-drag]',
- )}
- >
- {/*
- * Tree view options uses DropdownMenu (click-to-open). The
- * earlier hover-to-open HoverCard shape was unreachable from
- * keyboard and touch: Radix HoverCard's content root forcibly
- * sets `tabindex="-1"` on every tabbable descendant
- * (@radix-ui/react-hover-card@dist/index.mjs:172-177), and
- * hover cannot be triggered from keyboard/AT/touch at all. A
- * DropdownMenu opens on click/Enter/Space, routes arrow-key
- * focus between items, and is the shadcn-standard pattern
- * for toolbar menus.
- *
- * The trigger is always visible: the Show group is state-
- * independent, so the menu always has content. The Expand/
- * Collapse-all commands smart-hide individually when their
- * action would no-op (no folders; every folder already
- * expanded / collapsed), taking their separator with them.
- */}
- <DropdownMenu>
- <ToolbarDropdownTrigger icon={ListCollapse} label={t`Tree view options`} />
- <DropdownMenuContent
- align="end"
- className="min-w-52"
- data-testid="tree-options-menu"
- >
- {showExpandAll ? (
- <DropdownMenuItem onSelect={() => tree?.expandAll()}>
- <UnfoldVertical aria-hidden="true" />
- <Trans>Expand all</Trans>
- </DropdownMenuItem>
- ) : null}
- {showCollapseAll ? (
- <DropdownMenuItem onSelect={() => tree?.collapseAll()}>
- <FoldVertical aria-hidden="true" />
- <Trans>Collapse all</Trans>
- </DropdownMenuItem>
- ) : null}
- {showTreeStateSection ? <DropdownMenuSeparator /> : null}
- {/* Labeled `role="group"` so assistive tech announces the
- section; the visual DropdownMenuLabel alone is skipped
- by arrow-key menu navigation. Items read group-relative
- ("Hidden files") because the label carries the "Show";
- the unsectioned menu surfaces use the full-form labels. */}
- <DropdownMenuGroup aria-label={t`Show`}>
- <DropdownMenuLabel>
- <Trans>Show</Trans>
- </DropdownMenuLabel>
- <DropdownMenuCheckboxItem
- checked={showHiddenFiles}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showHiddenFiles: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="tree-options-show-hidden-files"
- >
- <Trans>Hidden files</Trans>
- </DropdownMenuCheckboxItem>
- <DropdownMenuCheckboxItem
- checked={showOkFolders}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showOkFolders: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="tree-options-show-ok-folders"
- >
- <Trans>.ok folders</Trans>
- </DropdownMenuCheckboxItem>
- <DropdownMenuCheckboxItem
- checked={showOnlyMarkdownFiles}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showOnlyMarkdownFiles: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="tree-options-show-only-markdown-files"
- >
- <Trans>Only markdown files</Trans>
- </DropdownMenuCheckboxItem>
- <DropdownMenuCheckboxItem
- checked={showSkillsSection}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showSkillsSection: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="tree-options-show-skills"
- >
- <Trans>Skills</Trans>
- </DropdownMenuCheckboxItem>
- </DropdownMenuGroup>
- </DropdownMenuContent>
- </DropdownMenu>
- <ToolbarButton
- icon={SquarePen}
- label={t`New file`}
- onClick={() => tree?.startCreating('file', initialCreateDir)}
- />
- {activeFolderHasTemplates ? (
- // Toolbar opens templates on click (not hover): a hover-only
- // flyout off an icon button isn't keyboard/touch reachable.
- // Mirrors the Tree view options dropdown above. Picking a
- // template runs the same inline-rename create flow as New file.
- <DropdownMenu>
- <ToolbarDropdownTrigger icon={FilePlus} label={t`New from template`} />
- <DropdownMenuContent
- align="end"
- className="min-w-52"
- onCloseAutoFocus={handleCreateMenuCloseAutoFocus}
- >
- <TemplateMenuRows
- parentDir={initialCreateDir}
- onSelectTemplate={(templateName) => {
- suppressCreateMenuFocusRestoreRef.current = true;
- tree?.createFromTemplate(initialCreateDir, templateName);
- }}
- ItemComponent={DropdownMenuItem}
- />
- </DropdownMenuContent>
- </DropdownMenu>
- ) : null}
- <ToolbarButton
- icon={FolderPlus}
- label={t`New folder`}
- onClick={() => tree?.startCreating('folder', initialCreateDir)}
- />
- </div>
+ {isElectronHost && isExpanded ? <NavigationHistoryControls /> : null}
</SidebarHeader>
{/*
* Pill row lives outside SidebarContent's overflow-auto boundary so
@@ -985,7 +895,7 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
* defensive — the sibling itself does NOT opt into drag like
* SidebarHeader does, but the explicit opt-out survives a future
* refactor that might place the row inside a drag region. Opacity
- * fades in lockstep with the toolbar so neither row visibly
+ * fades in lockstep with the header navigation so neither row visibly
* orphans under the macOS traffic-light region mid-slide.
*
* ErrorBoundary scope is intentionally tight: a pill render-throw
@@ -1075,16 +985,146 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
already each land at 8px, so stacking the group's own 8px
on top would double it to 16px. */}
<SidebarGroup className="min-h-0 px-0">
- <SidebarGroupLabel asChild className="shrink-0">
+ <SidebarGroupLabel className="shrink-0 gap-1">
<CollapsibleTrigger
// Marks the project-root header so right-click opens the project-scoped menu.
data-sidebar-root-context
- className="flex w-full items-center gap-1.5"
+ className="flex min-w-0 flex-1 items-center gap-1.5"
>
<FolderOpen className="size-3.5 shrink-0" />
<span className="truncate">{projectName}</span>
<ChevronRight className="size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90" />
</CollapsibleTrigger>
+ <ButtonGroup
+ aria-label={t`Files toolbar`}
+ data-testid="sidebar-toolbar"
+ className={cn(isElectronHost && '*:[-webkit-app-region:no-drag]')}
+ >
+ {/*
+ * Tree view options uses DropdownMenu (click-to-open). The
+ * earlier hover-to-open HoverCard shape was unreachable from
+ * keyboard and touch: Radix HoverCard's content root forcibly
+ * sets `tabindex="-1"` on every tabbable descendant
+ * (@radix-ui/react-hover-card@dist/index.mjs:172-177), and
+ * hover cannot be triggered from keyboard/AT/touch at all. A
+ * DropdownMenu opens on click/Enter/Space, routes arrow-key
+ * focus between items, and is the shadcn-standard pattern
+ * for toolbar menus.
+ *
+ * The trigger is always visible: the Show group is state-
+ * independent, so the menu always has content. The Expand/
+ * Collapse-all commands smart-hide individually when their
+ * action would no-op (no folders; every folder already
+ * expanded / collapsed), taking their separator with them.
+ */}
+ <DropdownMenu>
+ <ToolbarDropdownTrigger icon={ListCollapse} label={t`Tree view options`} />
+ <DropdownMenuContent
+ align="end"
+ className="min-w-52"
+ data-testid="tree-options-menu"
+ >
+ {showExpandAll ? (
+ <DropdownMenuItem onSelect={() => tree?.expandAll()}>
+ <UnfoldVertical aria-hidden="true" />
+ <Trans>Expand all</Trans>
+ </DropdownMenuItem>
+ ) : null}
+ {showCollapseAll ? (
+ <DropdownMenuItem onSelect={() => tree?.collapseAll()}>
+ <FoldVertical aria-hidden="true" />
+ <Trans>Collapse all</Trans>
+ </DropdownMenuItem>
+ ) : null}
+ {showTreeStateSection ? <DropdownMenuSeparator /> : null}
+ {/* Labeled `role="group"` so assistive tech announces the
+ section; the visual DropdownMenuLabel alone is skipped
+ by arrow-key menu navigation. Items read group-relative
+ ("Hidden files") because the label carries the "Show";
+ the unsectioned menu surfaces use the full-form labels. */}
+ <DropdownMenuGroup aria-label={t`Show`}>
+ <DropdownMenuLabel>
+ <Trans>Show</Trans>
+ </DropdownMenuLabel>
+ <DropdownMenuCheckboxItem
+ checked={showHiddenFiles}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showHiddenFiles: checked })
+ }
+ disabled={projectLocalBinding === null}
+ data-testid="tree-options-show-hidden-files"
+ >
+ <Trans>Hidden files</Trans>
+ </DropdownMenuCheckboxItem>
+ <DropdownMenuCheckboxItem
+ checked={showOkFolders}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showOkFolders: checked })
+ }
+ disabled={projectLocalBinding === null}
+ data-testid="tree-options-show-ok-folders"
+ >
+ <Trans>.ok folders</Trans>
+ </DropdownMenuCheckboxItem>
+ <DropdownMenuCheckboxItem
+ checked={showOnlyMarkdownFiles}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showOnlyMarkdownFiles: checked })
+ }
+ disabled={projectLocalBinding === null}
+ data-testid="tree-options-show-only-markdown-files"
+ >
+ <Trans>Only markdown files</Trans>
+ </DropdownMenuCheckboxItem>
+ <DropdownMenuCheckboxItem
+ checked={showSkillsSection}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showSkillsSection: checked })
+ }
+ disabled={projectLocalBinding === null}
+ data-testid="tree-options-show-skills"
+ >
+ <Trans>Skills</Trans>
+ </DropdownMenuCheckboxItem>
+ </DropdownMenuGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <ToolbarButton
+ icon={SquarePen}
+ label={t`New file`}
+ onClick={() => tree?.startCreating('file', initialCreateDir)}
+ shortcutId="new-item"
+ />
+ {activeFolderHasTemplates ? (
+ // Toolbar opens templates on click (not hover): a hover-only
+ // flyout off an icon button isn't keyboard/touch reachable.
+ // Mirrors the Tree view options dropdown above. Picking a
+ // template runs the same inline-rename create flow as New file.
+ <DropdownMenu>
+ <ToolbarDropdownTrigger icon={FilePlus} label={t`New from template`} />
+ <DropdownMenuContent
+ align="end"
+ className="min-w-52"
+ onCloseAutoFocus={handleCreateMenuCloseAutoFocus}
+ >
+ <TemplateMenuRows
+ parentDir={initialCreateDir}
+ onSelectTemplate={(templateName) => {
+ suppressCreateMenuFocusRestoreRef.current = true;
+ tree?.createFromTemplate(initialCreateDir, templateName);
+ }}
+ ItemComponent={DropdownMenuItem}
+ />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null}
+ <ToolbarButton
+ icon={FolderPlus}
+ label={t`New folder`}
+ onClick={() => tree?.startCreating('folder', initialCreateDir)}
+ shortcutId={isElectronHost ? 'new-folder' : undefined}
+ />
+ </ButtonGroup>
</SidebarGroupLabel>
<CollapsibleContent
className="flex max-h-[70vh] flex-col overflow-hidden"
diff --git a/packages/app/src/components/FileTree.tsx b/packages/app/src/components/FileTree.tsx
index 653b430df..52c4fedb0 100644
--- a/packages/app/src/components/FileTree.tsx
+++ b/packages/app/src/components/FileTree.tsx
@@ -204,7 +204,7 @@ import {
hashFromAssetPath,
hashFromDocName,
hashFromFolderPath,
- replaceHashWithoutNavigation,
+ pushHashWithoutNavigation,
} from '@/lib/doc-hash';
import { emitDocumentsChanged, subscribeToDocumentsChanged } from '@/lib/documents-events';
import {
@@ -1269,13 +1269,13 @@ export function FileTree({
openTarget(navigationTargetForDocument(target.docName, target.size), {
tabBehavior: 'replace-active',
});
- replaceHashWithoutNavigation(hashFromDocName(target.docName));
+ pushHashWithoutNavigation(hashFromDocName(target.docName));
} else if (target.kind === 'folder') {
openTarget(
{ kind: 'folder', target: target.folderPath, folderPath: target.folderPath },
{ tabBehavior: 'replace-active' },
);
- replaceHashWithoutNavigation(hashFromFolderPath(target.folderPath));
+ pushHashWithoutNavigation(hashFromFolderPath(target.folderPath));
} else {
const currentEntries = target.entries ?? documentsRef.current;
const entry = currentEntries.find(
@@ -1291,7 +1291,7 @@ export function FileTree({
},
{ tabBehavior: 'replace-active' },
);
- replaceHashWithoutNavigation(hashFromAssetPath(target.assetPath));
+ pushHashWithoutNavigation(hashFromAssetPath(target.assetPath));
}
notifySidebarFileSelected();
}
@@ -1314,7 +1314,7 @@ export function FileTree({
},
{ tabBehavior: 'replace-active' },
);
- replaceHashWithoutNavigation(action.hash);
+ pushHashWithoutNavigation(action.hash);
notifySidebarFileSelected();
return;
}
@@ -1336,7 +1336,7 @@ export function FileTree({
});
if (okTarget?.kind === 'asset') {
openTarget(okTarget, { tabBehavior: 'replace-active' });
- replaceHashWithoutNavigation(hashFromAssetPath(okTarget.assetPath));
+ pushHashWithoutNavigation(hashFromAssetPath(okTarget.assetPath));
notifySidebarFileSelected();
return;
}
diff --git a/packages/app/src/components/NavigationHistoryControls.dom.test.tsx b/packages/app/src/components/NavigationHistoryControls.dom.test.tsx
new file mode 100644
index 000000000..869fe9d4e
--- /dev/null
+++ b/packages/app/src/components/NavigationHistoryControls.dom.test.tsx
@@ -0,0 +1,145 @@
+import * as actualLinguiMacro from '@lingui/react/macro';
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, test, vi } from 'vitest';
+import { TooltipProvider } from '@/components/ui/tooltip';
+import { formatShortcut, formatShortcutLabel } from '@/lib/keyboard-shortcuts';
+import {
+ __resetLocalMenuActionBusForTests,
+ subscribeLocalMenuAction,
+} from '@/lib/local-menu-action-bus';
+import {
+ expectVisualClassTokens,
+ expectVisualClassTokensAbsent,
+} from '@/test-utils/visual-contract';
+
+class MockNavigationHistory extends EventTarget {
+ canGoBack = false;
+ canGoForward = false;
+}
+
+const navigationDescriptor = Object.getOwnPropertyDescriptor(window, 'navigation');
+
+function setNavigationHistory(navigation: MockNavigationHistory): void {
+ Object.defineProperty(window, 'navigation', {
+ configurable: true,
+ value: navigation,
+ });
+}
+
+vi.doMock('@lingui/react/macro', () => ({
+ ...actualLinguiMacro,
+ useLingui: () => ({
+ t: (strings: TemplateStringsArray, ...values: unknown[]) =>
+ strings.reduce((text, part, index) => `${text}${part}${values[index] ?? ''}`, ''),
+ }),
+}));
+
+async function renderControls() {
+ const { NavigationHistoryControls } = await import('./NavigationHistoryControls');
+ return render(
+ <TooltipProvider delayDuration={0}>
+ <NavigationHistoryControls />
+ </TooltipProvider>,
+ );
+}
+
+describe('NavigationHistoryControls', () => {
+ afterEach(() => {
+ cleanup();
+ __resetLocalMenuActionBusForTests();
+ if (navigationDescriptor) {
+ Object.defineProperty(window, 'navigation', navigationDescriptor);
+ } else {
+ Reflect.deleteProperty(window, 'navigation');
+ }
+ });
+
+ test('exposes localized button names, hidden directional icons, and shortcut tooltips', async () => {
+ const navigation = new MockNavigationHistory();
+ navigation.canGoBack = true;
+ navigation.canGoForward = true;
+ setNavigationHistory(navigation);
+ const user = userEvent.setup();
+ await renderControls();
+
+ const group = screen.getByRole('group', { name: 'Navigation history' });
+ const back = screen.getByRole('button', { name: 'Back' });
+ const forward = screen.getByRole('button', { name: 'Forward' });
+ expect(group.getAttribute('data-slot')).toBe('button-group');
+ expect(group.contains(back)).toBe(true);
+ expect(group.contains(forward)).toBe(true);
+ expect(back.getAttribute('data-variant')).toBe('ghost');
+ expect(back.getAttribute('data-size')).toBe('icon-sm');
+ expect(forward.getAttribute('data-variant')).toBe('ghost');
+ expect(forward.getAttribute('data-size')).toBe('icon-sm');
+ expect(back.querySelector('svg')?.getAttribute('aria-hidden')).toBe('true');
+ expect(forward.querySelector('svg')?.getAttribute('aria-hidden')).toBe('true');
+ await user.hover(back);
+ const backTooltip = await screen.findByRole('tooltip', {
+ name: `Back ${formatShortcutLabel('navigate-back')}`,
+ });
+ expect(backTooltip.querySelector('[data-slot="kbd"]')?.textContent).toBe(
+ formatShortcut('navigate-back'),
+ );
+ cleanup();
+ await renderControls();
+ const rerenderedForward = screen.getByRole('button', { name: 'Forward' });
+ await user.hover(rerenderedForward);
+ const forwardTooltip = await screen.findByRole('tooltip', {
+ name: `Forward ${formatShortcutLabel('navigate-forward')}`,
+ });
+ expect(forwardTooltip.querySelector('[data-slot="kbd"]')?.textContent).toBe(
+ formatShortcut('navigate-forward'),
+ );
+ });
+
+ test('emits navigation actions and keeps the controls out of the drag region', async () => {
+ const actions: string[] = [];
+ const unsubscribe = subscribeLocalMenuAction((action) => actions.push(action));
+ await renderControls();
+
+ const root = screen.getByTestId('navigation-history-controls');
+ const back = screen.getByRole('button', { name: 'Back' });
+ const forward = screen.getByRole('button', { name: 'Forward' });
+ expectVisualClassTokens(root.className, ['[-webkit-app-region:no-drag]']);
+ expectVisualClassTokensAbsent(root.className, ['[-webkit-app-region:drag]']);
+
+ fireEvent.click(back);
+ fireEvent.click(forward);
+ expect(actions).toEqual(['navigate-back', 'navigate-forward']);
+ unsubscribe();
+ });
+
+ test('disables pointer interaction for unavailable directions and follows history changes', async () => {
+ const navigation = new MockNavigationHistory();
+ navigation.canGoForward = true;
+ setNavigationHistory(navigation);
+ const actions: string[] = [];
+ const unsubscribe = subscribeLocalMenuAction((action) => actions.push(action));
+ await renderControls();
+
+ const back = screen.getByRole('button', { name: 'Back' });
+ const forward = screen.getByRole('button', { name: 'Forward' });
+ expect((back as HTMLButtonElement).disabled).toBe(true);
+ expect((forward as HTMLButtonElement).disabled).toBe(false);
+ expectVisualClassTokens(back.className, ['disabled:pointer-events-none']);
+ expectVisualClassTokensAbsent(back.className, ['disabled:pointer-events-auto']);
+
+ fireEvent.click(back);
+ fireEvent.click(forward);
+ expect(actions).toEqual(['navigate-forward']);
+
+ act(() => {
+ navigation.canGoBack = true;
+ navigation.canGoForward = false;
+ navigation.dispatchEvent(new Event('currententrychange'));
+ });
+
+ await waitFor(() => {
+ expect((back as HTMLButtonElement).disabled).toBe(false);
+ expect((forward as HTMLButtonElement).disabled).toBe(true);
+ });
+ unsubscribe();
+ });
+});
diff --git a/packages/app/src/components/NavigationHistoryControls.tsx b/packages/app/src/components/NavigationHistoryControls.tsx
new file mode 100644
index 000000000..212890c6b
--- /dev/null
+++ b/packages/app/src/components/NavigationHistoryControls.tsx
@@ -0,0 +1,92 @@
+import { useLingui } from '@lingui/react/macro';
+import { ArrowLeft, ArrowRight } from 'lucide-react';
+import { useSyncExternalStore } from 'react';
+import { Button } from '@/components/ui/button';
+import { ButtonGroup } from '@/components/ui/button-group';
+import { Kbd } from '@/components/ui/kbd';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
+import { formatShortcut, formatShortcutLabel } from '@/lib/keyboard-shortcuts';
+import { emitLocalMenuAction } from '@/lib/local-menu-action-bus';
+
+interface NavigationHistoryApi extends EventTarget {
+ readonly canGoBack: boolean;
+ readonly canGoForward: boolean;
+}
+
+const CAN_GO_BACK = 1;
+const CAN_GO_FORWARD = 2;
+const UNKNOWN_NAVIGATION_AVAILABILITY = CAN_GO_BACK | CAN_GO_FORWARD;
+
+function getNavigationHistoryApi(): NavigationHistoryApi | undefined {
+ if (typeof window === 'undefined') return undefined;
+ return (window as Window & { navigation?: NavigationHistoryApi }).navigation;
+}
+
+function getNavigationAvailability(): number {
+ const navigation = getNavigationHistoryApi();
+ if (!navigation) return UNKNOWN_NAVIGATION_AVAILABILITY;
+ return (navigation.canGoBack ? CAN_GO_BACK : 0) | (navigation.canGoForward ? CAN_GO_FORWARD : 0);
+}
+
+function subscribeNavigationAvailability(onChange: () => void): () => void {
+ const navigation = getNavigationHistoryApi();
+ if (!navigation) return () => {};
+ navigation.addEventListener('currententrychange', onChange);
+ return () => navigation.removeEventListener('currententrychange', onChange);
+}
+
+export function NavigationHistoryControls() {
+ const { t } = useLingui();
+ const navigationAvailability = useSyncExternalStore(
+ subscribeNavigationAvailability,
+ getNavigationAvailability,
+ () => UNKNOWN_NAVIGATION_AVAILABILITY,
+ );
+ const canGoBack = (navigationAvailability & CAN_GO_BACK) !== 0;
+ const canGoForward = (navigationAvailability & CAN_GO_FORWARD) !== 0;
+ const backShortcut = formatShortcut('navigate-back');
+ const backShortcutLabel = formatShortcutLabel('navigate-back');
+ const forwardShortcut = formatShortcut('navigate-forward');
+ const forwardShortcutLabel = formatShortcutLabel('navigate-forward');
+
+ return (
+ <ButtonGroup
+ aria-label={t`Navigation history`}
+ className="shrink-0 [-webkit-app-region:no-drag]"
+ data-testid="navigation-history-controls"
+ >
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ aria-label={t`Back`}
+ disabled={!canGoBack}
+ onClick={() => emitLocalMenuAction('navigate-back')}
+ size="icon-sm"
+ variant="ghost"
+ >
+ <ArrowLeft aria-hidden="true" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <span>{t`Back`}</span> <Kbd aria-label={backShortcutLabel}>{backShortcut}</Kbd>
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ aria-label={t`Forward`}
+ disabled={!canGoForward}
+ onClick={() => emitLocalMenuAction('navigate-forward')}
+ size="icon-sm"
+ variant="ghost"
+ >
+ <ArrowRight aria-hidden="true" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <span>{t`Forward`}</span> <Kbd aria-label={forwardShortcutLabel}>{forwardShortcut}</Kbd>
+ </TooltipContent>
+ </Tooltip>
+ </ButtonGroup>
+ );
+}
diff --git a/packages/app/src/components/ShareButton.dom.test.tsx b/packages/app/src/components/ShareButton.dom.test.tsx
index 611c2b544..beb8b53fc 100644
--- a/packages/app/src/components/ShareButton.dom.test.tsx
+++ b/packages/app/src/components/ShareButton.dom.test.tsx
@@ -25,6 +25,7 @@
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
+import { formatShortcutBinding, formatShortcutBindingLabel } from '@/lib/keyboard-shortcuts';
import type { ShareTargetInput } from '@/lib/share/run-share-action';
// ShareButton mounts a Radix Tooltip + Popover (focus-scope) which reach for
@@ -165,6 +166,12 @@ describe('ShareButton', () => {
// `initialCopied` (which keys off `autoCopyFailed`).
expect(screen.getByRole('button', { name: 'Copy' })).not.toBeNull();
expect(screen.queryByRole('button', { name: 'Copied!' })).toBeNull();
+ const copyBinding = { mac: '⌘ C', windowsLinux: 'Ctrl C' };
+ const copyKeycap = screen
+ .getByTestId('share-button-popover')
+ .querySelector('[data-slot="kbd"]');
+ expect(copyKeycap?.textContent).toBe(formatShortcutBinding(copyBinding));
+ expect(copyKeycap?.getAttribute('aria-label')).toBe(formatShortcutBindingLabel(copyBinding));
expect(globalThis.fetch).toHaveBeenCalledWith('/api/share/construct-url', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
diff --git a/packages/app/src/components/ShareButton.tsx b/packages/app/src/components/ShareButton.tsx
index 68ca3d06d..24b871df4 100644
--- a/packages/app/src/components/ShareButton.tsx
+++ b/packages/app/src/components/ShareButton.tsx
@@ -34,9 +34,11 @@ import { toast } from 'sonner';
import { CopyButton } from '@/components/CopyButton';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
+import { Kbd } from '@/components/ui/kbd';
import { Popover, PopoverAnchor, PopoverContent } from '@/components/ui/popover';
import { useGitSyncStatusDetailed } from '@/hooks/use-git-sync-status';
import { dispatchExternalLinkClick } from '@/lib/external-link';
+import { formatShortcutBinding, formatShortcutBindingLabel } from '@/lib/keyboard-shortcuts';
import { scheduleClipboardWrite } from '@/lib/share/clipboard-adapter';
import {
CLIPBOARD_ERROR_TOAST,
@@ -48,6 +50,7 @@ import { ShareFreshnessWarning, shareFreshnessRowVisible } from './ShareFreshnes
/** Docs page explaining the share flow (links out of the popover). */
const SHARE_DOCS_URL = 'https://openknowledge.ai/docs/features/share';
+const COPY_SHORTCUT = { mac: '⌘ C', windowsLinux: 'Ctrl C' };
export interface ShareButtonProps {
/**
@@ -94,6 +97,8 @@ export function ShareButton({ input, onClickWhenNoRemote }: ShareButtonProps) {
const hasRemote = status?.hasRemote === true;
const triggerDisabled = input === null;
const showFreshnessRow = shareFreshnessRowVisible(sharePopover?.freshness, status);
+ const copyShortcut = formatShortcutBinding(COPY_SHORTCUT);
+ const copyShortcutLabel = formatShortcutBindingLabel(COPY_SHORTCUT);
async function handleClick() {
if (busy) return;
@@ -180,7 +185,10 @@ export function ShareButton({ input, onClickWhenNoRemote }: ShareButtonProps) {
</p>
{sharePopover?.autoCopyFailed ? (
<p className="text-xs text-muted-foreground">
- <Trans>Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app.</Trans>
+ <Trans>
+ Use <Kbd aria-label={copyShortcutLabel}>{copyShortcut}</Kbd> to copy the link below,
+ or open OK in the desktop app.
+ </Trans>
</p>
) : null}
<div className="relative">
diff --git a/packages/app/src/components/SkillsSidebarSection.tsx b/packages/app/src/components/SkillsSidebarSection.tsx
index 8824b09c9..6aea158af 100644
--- a/packages/app/src/components/SkillsSidebarSection.tsx
+++ b/packages/app/src/components/SkillsSidebarSection.tsx
@@ -41,7 +41,7 @@ import {
} from '@/components/ui/sidebar';
import { useDocumentContext } from '@/editor/DocumentContext';
import { useSkills } from '@/hooks/use-skills';
-import { hashFromDocName, hashFromSkillFile, replaceHashWithoutNavigation } from '@/lib/doc-hash';
+import { hashFromDocName, hashFromSkillFile, pushHashWithoutNavigation } from '@/lib/doc-hash';
import { subscribeToSkillsChanged } from '@/lib/documents-events';
import {
projectSkillContentDocName,
@@ -331,11 +331,11 @@ function SkillFolderContents({ skill }: { skill: SkillsListEntry }) {
// Open a project-skill content doc as a PERSISTENT tab. `append` (not
// `replace-active`) so opening a second skill keeps the first open — skills are
// worked on side-by-side, unlike the file tree's single preview tab. `openTarget`
- // still activates the newly-opened tab; `replaceHashWithoutNavigation` syncs the
+ // still activates the newly-opened tab; `pushHashWithoutNavigation` records the
// hash (bare `openDocument` bypasses the hash and a later nav effect steals focus).
function openProjectDoc(docName: string) {
openTarget({ kind: 'doc', target: docName, docName }, { tabBehavior: 'append' });
- replaceHashWithoutNavigation(hashFromDocName(docName));
+ pushHashWithoutNavigation(hashFromDocName(docName));
}
// Open a skill file. A PROJECT skill's `.md`/`.mdx` reference is a real
@@ -356,7 +356,7 @@ function SkillFolderContents({ skill }: { skill: SkillsListEntry }) {
path: filePath,
};
openTarget(target, { tabBehavior: 'replace-active' });
- replaceHashWithoutNavigation(
+ pushHashWithoutNavigation(
hashFromSkillFile({ scope: skill.scope, name: skill.name, path: filePath }),
);
}
diff --git a/packages/app/src/components/command-palette-commands.ts b/packages/app/src/components/command-palette-commands.ts
index 2070f24cf..e50133bee 100644
--- a/packages/app/src/components/command-palette-commands.ts
+++ b/packages/app/src/components/command-palette-commands.ts
@@ -11,6 +11,8 @@ import { msg, t } from '@lingui/core/macro';
import {
Blocks,
Bug,
+ ChevronLeft,
+ ChevronRight,
Copy,
Download,
Eye,
@@ -165,6 +167,8 @@ export interface PaletteCommand {
* palette in lockstep with the native menu's `MENU_LABELS` source.
*/
const PALETTE_COMMAND_LABELS = {
+ back: msg`Back`,
+ forward: msg`Forward`,
newFile: msg`New file`,
newFolder: msg`New folder`,
openGraph: msg`Open graph`,
@@ -216,6 +220,8 @@ export { PALETTE_COMMAND_LABELS };
* `toPaletteCommand` throws at module load if an id is missing, rather than
* silently substituting a wrong default. */
const COMMAND_ICONS: Record<string, ComponentType<{ className?: string }>> = {
+ 'navigate-back': ChevronLeft,
+ 'navigate-forward': ChevronRight,
'new-file': FilePlus2,
'new-folder': FolderPlus,
'open-graph': Network,
diff --git a/packages/app/src/components/navigation-targets.ts b/packages/app/src/components/navigation-targets.ts
index 3ae9d708e..6712882aa 100644
--- a/packages/app/src/components/navigation-targets.ts
+++ b/packages/app/src/components/navigation-targets.ts
@@ -351,7 +351,7 @@ export function resolveNavigationTarget(
* Hash-driven navigation lands on the folder overview even when an
* `index.md` (or legacy folder note) exists. A folder-overview tab opened
* via `openTarget({kind:'folder', ...})` writes its hash silently via
- * `history.replaceState`; if `NavigationHandler`'s effect re-fires (page
+ * `history.pushState`; if `NavigationHandler`'s effect re-fires (page
* list populating, tab close re-assigning the hash) and the resolver
* promotes `folder` → `folder-index`, the deps-driven re-resolution opens
* a doc tab on top of the folder tab. Wikilinks + graph/links nav still
diff --git a/packages/app/src/editor/sidebar-drop.test.ts b/packages/app/src/editor/sidebar-drop.test.ts
index 865d73bbf..ee663172e 100644
--- a/packages/app/src/editor/sidebar-drop.test.ts
+++ b/packages/app/src/editor/sidebar-drop.test.ts
@@ -1,4 +1,5 @@
import { describe, expect, test, vi } from 'vitest';
+import { isManagedHashHistoryState } from '@/lib/doc-hash';
import {
OK_SIDEBAR_DRAG_MIME,
type SidebarDragPayload,
@@ -67,7 +68,7 @@ describe('createSidebarAwareHandleDrop', () => {
});
describe('openSidebarDropPayload', () => {
- test('opens sidebar payloads as appended tabs and replaces the hash directly', () => {
+ test('opens sidebar payloads as appended tabs and pushes the hash directly', () => {
const restoreWindow = installFakeWindow({
hash: '#/old',
pathname: '/app',
@@ -86,18 +87,23 @@ describe('openSidebarDropPayload', () => {
{ kind: 'doc', target: 'notes/Intro', docName: 'notes/Intro' },
{ tabBehavior: 'append' },
);
- expect(fakeReplaceState).toHaveBeenCalledWith(null, '', '/app?workspace=ok#/notes/Intro');
+ expect(fakePushState).toHaveBeenCalledWith(
+ expect.anything(),
+ '',
+ '/app?workspace=ok#/notes/Intro',
+ );
+ expect(isManagedHashHistoryState(fakePushState.mock.calls[0]?.[0])).toBe(true);
});
});
-let fakeReplaceState = vi.fn((_state: unknown, _unused: string, _url: string) => {});
+let fakePushState = vi.fn((_state: unknown, _unused: string, _url: string) => {});
function installFakeWindow(location: {
hash: string;
pathname: string;
search: string;
}): () => void {
- fakeReplaceState = vi.fn((_state: unknown, _unused: string, _url: string) => {});
+ fakePushState = vi.fn((_state: unknown, _unused: string, _url: string) => {});
const global = globalThis as { window?: unknown };
const previous = global.window;
Object.defineProperty(globalThis, 'window', {
@@ -105,7 +111,7 @@ function installFakeWindow(location: {
value: {
location,
history: {
- replaceState: fakeReplaceState,
+ pushState: fakePushState,
},
},
});
diff --git a/packages/app/src/editor/sidebar-drop.ts b/packages/app/src/editor/sidebar-drop.ts
index ecf4ea87c..2ceffb9fc 100644
--- a/packages/app/src/editor/sidebar-drop.ts
+++ b/packages/app/src/editor/sidebar-drop.ts
@@ -1,5 +1,5 @@
import type { EditorOptions } from '@tiptap/core';
-import { replaceHashWithoutNavigation } from '@/lib/doc-hash';
+import { pushHashWithoutNavigation } from '@/lib/doc-hash';
import {
navigationForSidebarDragPayload,
parseSidebarDragPayload,
@@ -35,5 +35,5 @@ export function openSidebarDropPayload(
): void {
const navigation = navigationForSidebarDragPayload(payload);
openTarget(navigation.target, { tabBehavior: 'append' });
- replaceHashWithoutNavigation(navigation.hash);
+ pushHashWithoutNavigation(navigation.hash);
}
diff --git a/packages/app/src/lib/command-menu-parity.test.ts b/packages/app/src/lib/command-menu-parity.test.ts
index 3dd406823..25ad90e29 100644
--- a/packages/app/src/lib/command-menu-parity.test.ts
+++ b/packages/app/src/lib/command-menu-parity.test.ts
@@ -21,7 +21,11 @@ import { COMMAND_IDENTITIES, type MenuPlatform } from '@inkeep/open-knowledge-co
import { describe, expect, test } from 'vitest';
import { PALETTE_COMMANDS } from '@/components/command-palette-commands';
import { APP_RESERVED_IDS, PALETTE_COMMAND_IDS } from '@/lib/command-menu-parity.test-helper';
-import { formatShortcut, type KeyboardShortcutId } from '@/lib/keyboard-shortcuts';
+import {
+ formatShortcut,
+ type KeyboardShortcutId,
+ type ShortcutPlatform,
+} from '@/lib/keyboard-shortcuts';
import { OK_MENU_ACTIONS } from '@/lib/ok-menu-actions';
import {
buildMenuTemplate,
@@ -71,6 +75,8 @@ const OS_ROLE_EXEMPT = new Set<string>([
// state-aware View toggles contribute both their Show/Hide variants). "Full path"
// / "Relative path" are the Copy-path submenu leaves the palette flattens.
const PALETTE_COMMAND_LABELS = new Set<string>([
+ 'Back',
+ 'Forward',
'New file',
'New folder',
'New from template',
@@ -140,6 +146,8 @@ function makeFullDeps(): MenuDeps {
onSendFeedback: noop,
onCheckForUpdates: noop,
onUninstall: noop,
+ onNavigateBack: noop,
+ onNavigateForward: noop,
activeTarget: { kind: 'doc', target: 'doc.md' } as MenuDeps['activeTarget'],
onNewFile: noop,
onNewFolder: noop,
@@ -314,6 +322,8 @@ describe('command-menu parity ratchet', () => {
// makeFullDeps sets the panels visible, so the state-aware View toggle
// renders its "Hide …" variant.
expect(labels.has('Check for updates')).toBe(true);
+ expect(labels.has('Back')).toBe(true);
+ expect(labels.has('Forward')).toBe(true);
expect(labels.has('Move to Trash')).toBe(true);
expect(labels.has('Hide sidebar')).toBe(true);
expect(labels.has('New Terminal')).toBe(true);
@@ -324,7 +334,18 @@ describe('command-menu parity ratchet', () => {
// binding must agree. Guards the live drift between menu.ts's hand-typed
// accelerators and the shortcut registry (they share no import); the id-spaces
// differ, so this map bridges menu label → shortcut id.
- const MENU_SHORTCUT_PAIRS: Array<{ menuLabel: string; shortcutId: KeyboardShortcutId }> = [
+ interface MenuShortcutPair {
+ menuLabel: string;
+ shortcutId: KeyboardShortcutId;
+ }
+
+ const NAVIGATION_HISTORY_SHORTCUT_PAIRS: readonly MenuShortcutPair[] = [
+ { menuLabel: 'Back', shortcutId: 'navigate-back' },
+ { menuLabel: 'Forward', shortcutId: 'navigate-forward' },
+ ];
+
+ const MENU_SHORTCUT_PAIRS: readonly MenuShortcutPair[] = [
+ ...NAVIGATION_HISTORY_SHORTCUT_PAIRS,
{ menuLabel: 'New file', shortcutId: 'new-item' },
{ menuLabel: 'New folder', shortcutId: 'new-folder' },
{ menuLabel: 'Switch project', shortcutId: 'switch-project' },
@@ -346,26 +367,47 @@ describe('command-menu parity ratchet', () => {
if (/CmdOrCtrl|Cmd|Ctrl|⌘|⌃/.test(s)) tokens.add('MOD');
if (/Shift|⇧/.test(s)) tokens.add('SHIFT');
if (/Alt|Option|⌥/.test(s)) tokens.add('ALT');
- let base = s.replace(/CmdOrCtrl|Cmd|Ctrl|Shift|Alt|Option/g, '').replace(/[⌘⌃⇧⌥+\s]/g, '');
+ let base = s
+ .replaceAll('←', 'Left')
+ .replaceAll('→', 'Right')
+ .replaceAll('↑', 'Up')
+ .replaceAll('↓', 'Down')
+ .replace(/CmdOrCtrl|Cmd|Ctrl|Shift|Alt|Option/g, '')
+ .replace(/[⌘⌃⇧⌥+\s]/g, '');
if (/^(Delete|Backspace|⌫)$/i.test(base)) base = 'DEL';
tokens.add(`KEY:${base.toUpperCase()}`);
return [...tokens].sort().join(',');
}
- test('Ratchet D: menu accelerators agree with the keyboard-shortcut registry', () => {
- const accelByLabel = new Map<string, string>();
- for (const leaf of collectLeavesForPlatform('darwin')) {
- if (leaf.accelerator) accelByLabel.set(normalizeLabel(leaf.label), leaf.accelerator);
- }
- const mismatches: Array<{ menuLabel: string; accelerator?: string; shortcut: string }> = [];
- for (const { menuLabel, shortcutId } of MENU_SHORTCUT_PAIRS) {
- const accelerator = accelByLabel.get(menuLabel);
- const shortcut = formatShortcut(shortcutId, 'mac');
+ function expectMenuShortcutParity(
+ pairs: readonly MenuShortcutPair[],
+ menuPlatform: NodeJS.Platform,
+ shortcutPlatform: ShortcutPlatform,
+ ): void {
+ const mismatches: Array<{
+ menuLabel: string;
+ accelerator?: string;
+ shortcut: string;
+ }> = [];
+ const leaves = collectLeavesForPlatform(menuPlatform);
+ for (const pair of pairs) {
+ const accelerator = leaves.find(
+ (leaf) => normalizeLabel(leaf.label) === pair.menuLabel,
+ )?.accelerator;
+ const shortcut = formatShortcut(pair.shortcutId, shortcutPlatform);
if (accelerator === undefined || chordTokens(accelerator) !== chordTokens(shortcut)) {
- mismatches.push({ menuLabel, accelerator, shortcut });
+ mismatches.push({ menuLabel: pair.menuLabel, accelerator, shortcut });
}
}
expect(mismatches).toEqual([]);
+ }
+
+ test('Ratchet D: menu accelerators agree with the keyboard-shortcut registry', () => {
+ expectMenuShortcutParity(MENU_SHORTCUT_PAIRS, 'darwin', 'mac');
+ });
+
+ test('Ratchet D: Windows/Linux navigation accelerators agree with the shortcut registry', () => {
+ expectMenuShortcutParity(NAVIGATION_HISTORY_SHORTCUT_PAIRS, 'win32', 'windowsLinux');
});
// Exactly one bridge.onMenuAction listener (the bus forwarder) — no subscriber
@@ -432,6 +474,43 @@ describe('command-menu parity ratchet', () => {
describe('command identity registry (Phase 2b)', () => {
const OK_MENU_ACTION_SET = new Set<string>(OK_MENU_ACTIONS);
+ test('navigation-history commands pair actions with ordered platform placements', () => {
+ const historyCommands = COMMAND_IDENTITIES.filter((command) =>
+ ['navigate-back', 'navigate-forward'].includes(command.id),
+ );
+
+ expect(
+ historyCommands.map(({ id, menuActionId, shortcutId, shortcutDesktopOnly, menu }) => ({
+ id,
+ menuActionId,
+ shortcutId,
+ shortcutDesktopOnly,
+ menu,
+ })),
+ ).toEqual([
+ {
+ id: 'navigate-back',
+ menuActionId: 'navigate-back',
+ shortcutId: 'navigate-back',
+ shortcutDesktopOnly: true,
+ menu: [
+ { section: 'view-history', order: 0, platform: 'mac', accelerator: 'Cmd+[' },
+ { section: 'view-history', order: 0, platform: 'other', accelerator: 'Alt+Left' },
+ ],
+ },
+ {
+ id: 'navigate-forward',
+ menuActionId: 'navigate-forward',
+ shortcutId: 'navigate-forward',
+ shortcutDesktopOnly: true,
+ menu: [
+ { section: 'view-history', order: 1, platform: 'mac', accelerator: 'Cmd+]' },
+ { section: 'view-history', order: 1, platform: 'other', accelerator: 'Alt+Right' },
+ ],
+ },
+ ]);
+ });
+
test('every registry menuActionId is a real OkMenuAction', () => {
const bad = COMMAND_IDENTITIES.flatMap((cmd) =>
cmd.menuActionId && !OK_MENU_ACTION_SET.has(cmd.menuActionId) ? [cmd.id] : [],
diff --git a/packages/app/src/lib/desktop-bridge-types.ts b/packages/app/src/lib/desktop-bridge-types.ts
index 78b83690e..e72158c3f 100644
--- a/packages/app/src/lib/desktop-bridge-types.ts
+++ b/packages/app/src/lib/desktop-bridge-types.ts
@@ -221,6 +221,9 @@ export type OkMenuAction =
| 'version-history'
| 'focus-search'
| 'focus-command-palette'
+ // Navigation history.
+ | 'navigate-back'
+ | 'navigate-forward'
// File menu state-aware items. See bridge-contract.ts for
// rationale; mirrored here per the OkDesktopBridge 3-way-mirror invariant.
| 'new-from-template'
diff --git a/packages/app/src/lib/doc-hash.test.ts b/packages/app/src/lib/doc-hash.test.ts
index fc57ccada..a07bebdd0 100644
--- a/packages/app/src/lib/doc-hash.test.ts
+++ b/packages/app/src/lib/doc-hash.test.ts
@@ -1,4 +1,4 @@
-import { describe, expect, test } from 'vitest';
+import { describe, expect, test, vi } from 'vitest';
import {
anchorFromHash,
assetPathFromHash,
@@ -9,6 +9,10 @@ import {
hashFromFolderPath,
hashFromSkillFile,
isContentRootHash,
+ isManagedHashHistoryState,
+ markCurrentHashHistoryEntry,
+ pushHashWithoutNavigation,
+ replaceHashWithoutNavigation,
type SkillFileHashTarget,
skillFileFromHash,
} from './doc-hash';
@@ -141,6 +145,119 @@ describe('hashFromFolderPath', () => {
});
});
+describe('pushHashWithoutNavigation', () => {
+ function installWindow(hash: string) {
+ const pushState = vi.fn();
+ const replaceState = vi.fn();
+ const previousWindow = globalThis.window;
+ Object.defineProperty(globalThis, 'window', {
+ configurable: true,
+ value: {
+ location: {
+ hash,
+ pathname: '/app',
+ search: '?workspace=ok',
+ },
+ history: {
+ pushState,
+ replaceState,
+ state: { preserved: 'value' },
+ },
+ },
+ });
+ return {
+ pushState,
+ replaceState,
+ restore: () => {
+ if (previousWindow === undefined) {
+ Reflect.deleteProperty(globalThis, 'window');
+ return;
+ }
+ Object.defineProperty(globalThis, 'window', {
+ configurable: true,
+ value: previousWindow,
+ });
+ },
+ };
+ }
+
+ test('pushes a distinct hash while preserving the current path and query', () => {
+ const { pushState, restore } = installWindow('#/old');
+ try {
+ pushHashWithoutNavigation('#/new');
+ } finally {
+ restore();
+ }
+
+ expect(pushState).toHaveBeenCalledOnce();
+ expect(pushState).toHaveBeenCalledWith(
+ expect.objectContaining({ preserved: 'value' }),
+ '',
+ '/app?workspace=ok#/new',
+ );
+ expect(isManagedHashHistoryState(pushState.mock.calls[0]?.[0])).toBe(true);
+ });
+
+ test('does not push when the hash is already current', () => {
+ const { pushState, restore } = installWindow('#/current');
+ try {
+ pushHashWithoutNavigation('#/current');
+ } finally {
+ restore();
+ }
+
+ expect(pushState).not.toHaveBeenCalled();
+ });
+
+ test('marks the current entry while preserving existing history state', () => {
+ const { replaceState, restore } = installWindow('#/current');
+ try {
+ markCurrentHashHistoryEntry();
+ } finally {
+ restore();
+ }
+
+ expect(replaceState).toHaveBeenCalledOnce();
+ expect(replaceState).toHaveBeenCalledWith(expect.objectContaining({ preserved: 'value' }), '');
+ expect(isManagedHashHistoryState(replaceState.mock.calls[0]?.[0])).toBe(true);
+ });
+
+ test('does not mark an entry that is already managed', () => {
+ const { replaceState, restore } = installWindow('#/current');
+ try {
+ markCurrentHashHistoryEntry();
+ const managedState = replaceState.mock.calls[0]?.[0];
+ Object.defineProperty(window.history, 'state', {
+ configurable: true,
+ value: managedState,
+ });
+ replaceState.mockClear();
+
+ markCurrentHashHistoryEntry();
+ } finally {
+ restore();
+ }
+
+ expect(replaceState).not.toHaveBeenCalled();
+ });
+
+ test('replaces the current hash while preserving managed history state', () => {
+ const { replaceState, restore } = installWindow('#/current');
+ try {
+ replaceHashWithoutNavigation('');
+ } finally {
+ restore();
+ }
+
+ expect(replaceState).toHaveBeenCalledWith(
+ expect.objectContaining({ preserved: 'value' }),
+ '',
+ '/app?workspace=ok',
+ );
+ expect(isManagedHashHistoryState(replaceState.mock.calls[0]?.[0])).toBe(true);
+ });
+});
+
describe('encodeShareTargetForHash', () => {
test('doc target → #/<doc> with no branch', () => {
expect(encodeShareTargetForHash('doc', 'intro.md')).toBe('#/intro.md');
diff --git a/packages/app/src/lib/doc-hash.ts b/packages/app/src/lib/doc-hash.ts
index 055f5feec..d0bceea55 100644
--- a/packages/app/src/lib/doc-hash.ts
+++ b/packages/app/src/lib/doc-hash.ts
@@ -57,10 +57,43 @@ export function hashFromDocName(docName: string, anchor?: string | null): string
return anchor ? `${base}#${encodeURIComponent(anchor)}` : base;
}
+const MANAGED_HASH_HISTORY_STATE_KEY = '__okHashHistoryEntry';
+
+function managedHashHistoryState(state: unknown): Record<string, unknown> {
+ const preservedState = typeof state === 'object' && state !== null ? state : {};
+ return { ...preservedState, [MANAGED_HASH_HISTORY_STATE_KEY]: true };
+}
+
+export function isManagedHashHistoryState(state: unknown): boolean {
+ return (
+ typeof state === 'object' &&
+ state !== null &&
+ (state as Record<string, unknown>)[MANAGED_HASH_HISTORY_STATE_KEY] === true
+ );
+}
+
+export function markCurrentHashHistoryEntry(): void {
+ if (isManagedHashHistoryState(window.history.state)) return;
+ window.history.replaceState(managedHashHistoryState(window.history.state), '');
+}
+
export function replaceHashWithoutNavigation(hash: string): void {
+ const { pathname, search } = window.location;
+ window.history.replaceState(
+ managedHashHistoryState(window.history.state),
+ '',
+ `${pathname}${search}${hash}`,
+ );
+}
+
+export function pushHashWithoutNavigation(hash: string): void {
if (window.location.hash === hash) return;
const { pathname, search } = window.location;
- window.history.replaceState(null, '', `${pathname}${search}${hash}`);
+ window.history.pushState(
+ managedHashHistoryState(window.history.state),
+ '',
+ `${pathname}${search}${hash}`,
+ );
}
/**
diff --git a/packages/app/src/lib/keyboard-shortcuts.test.ts b/packages/app/src/lib/keyboard-shortcuts.test.ts
index 44c9bb2bf..0ea8c97b2 100644
--- a/packages/app/src/lib/keyboard-shortcuts.test.ts
+++ b/packages/app/src/lib/keyboard-shortcuts.test.ts
@@ -30,6 +30,10 @@ describe('keyboard shortcut registry', () => {
expect(formatShortcut('tab-next', 'mac')).toBe('⌃ Tab');
expect(formatShortcut('tab-previous', 'mac')).toBe('⌃⇧ Tab');
expect(formatShortcut('tab-reopen-closed', 'mac')).toBe('⇧⌘ T');
+ expect(formatShortcut('navigate-back', 'mac')).toBe('⌘ [');
+ expect(formatShortcut('navigate-back', 'windowsLinux')).toBe('Alt ←');
+ expect(formatShortcut('navigate-forward', 'mac')).toBe('⌘ ]');
+ expect(formatShortcut('navigate-forward', 'windowsLinux')).toBe('Alt →');
});
test('formats spoken shortcut labels for accessible names', () => {
@@ -48,6 +52,41 @@ describe('keyboard shortcut registry', () => {
'Control Shift Left Bracket or Control Shift Right Bracket',
);
expect(formatShortcutLabel('tab-next', 'mac')).toBe('Control Tab');
+ expect(formatShortcutLabel('navigate-back', 'mac')).toBe('Command Left Bracket');
+ expect(formatShortcutLabel('navigate-back', 'windowsLinux')).toBe('Alt Left Arrow');
+ expect(formatShortcutLabel('navigate-forward', 'mac')).toBe('Command Right Bracket');
+ expect(formatShortcutLabel('navigate-forward', 'windowsLinux')).toBe('Alt Right Arrow');
+ });
+
+ test('navigation-history accelerators are native-only and never renderer-matched', () => {
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: true, ctrlKey: false, altKey: false, key: '[' },
+ 'navigate-back',
+ 'mac',
+ ),
+ ).toBe(false);
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: false, ctrlKey: false, altKey: true, key: 'ArrowLeft' },
+ 'navigate-back',
+ 'windowsLinux',
+ ),
+ ).toBe(false);
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: true, ctrlKey: false, altKey: false, key: ']' },
+ 'navigate-forward',
+ 'mac',
+ ),
+ ).toBe(false);
+ expect(
+ matchesKeyboardShortcut(
+ { metaKey: false, ctrlKey: false, altKey: true, key: 'ArrowRight' },
+ 'navigate-forward',
+ 'windowsLinux',
+ ),
+ ).toBe(false);
});
test('matches settings shortcut exactly and excludes Alt combinations', () => {
diff --git a/packages/app/src/lib/keyboard-shortcuts.ts b/packages/app/src/lib/keyboard-shortcuts.ts
index 264cf60a9..6657b7b7d 100644
--- a/packages/app/src/lib/keyboard-shortcuts.ts
+++ b/packages/app/src/lib/keyboard-shortcuts.ts
@@ -218,6 +218,22 @@ const KEYBOARD_SHORTCUT_DEFINITIONS = [
},
],
},
+ {
+ id: 'navigate-back',
+ category: 'navigation',
+ title: msg`Back`,
+ description: msg`Traverse OpenKnowledge navigation history backward.`,
+ scope: msg`OK Desktop`,
+ bindings: [{ mac: '⌘ [', windowsLinux: 'Alt ←' }],
+ },
+ {
+ id: 'navigate-forward',
+ category: 'navigation',
+ title: msg`Forward`,
+ description: msg`Traverse OpenKnowledge navigation history forward.`,
+ scope: msg`OK Desktop`,
+ bindings: [{ mac: '⌘ ]', windowsLinux: 'Alt →' }],
+ },
{
id: 'tab-new',
category: 'navigation',
diff --git a/packages/app/src/lib/ok-menu-actions.ts b/packages/app/src/lib/ok-menu-actions.ts
index 3eb590050..801e2af61 100644
--- a/packages/app/src/lib/ok-menu-actions.ts
+++ b/packages/app/src/lib/ok-menu-actions.ts
@@ -24,6 +24,8 @@ export const OK_MENU_ACTIONS = [
'version-history',
'focus-search',
'focus-command-palette',
+ 'navigate-back',
+ 'navigate-forward',
'new-from-template',
'duplicate',
'move-to-trash',
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index f604d3c0b..1632be70b 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -37,9 +37,6 @@
"-r_Kx7": ["Create skill"],
"-slrNR": ["Toggle a task list."],
"-uaQnI": ["No matching worktrees or branches."],
- "-wePNM": [
- "Search matches file names, paths, and folders. Open a file to search its body (⌘F)."
- ],
"-zA2E7": ["Couldn't create the worktree. Try a different name."],
"-zy2Nq": ["Type"],
"0-31GV": ["Removing"],
@@ -241,7 +238,6 @@
"). Any local edits will be replaced — your current version is saved to history first, so you can restore it."
],
"484LKL": ["Remove link"],
- "48uGTI": ["Failed to load docs. Press Escape and re-open to retry."],
"494br3": ["Shared with everyone on this project — committed to config.yml via git."],
"4A3Yzu": ["Code block"],
"4BITzH": ["Error:"],
@@ -360,6 +356,7 @@
"62bOuM": ["Latest edit"],
"636K3K": ["Delete adjacent chip"],
"67f-3g": ["Duplicate succeeded but the sidebar may be out of date — refresh to resync"],
+ "69KLIV": ["Escape"],
"6Aih4U": ["Offline"],
"6EKG_c": ["What agents match on to decide when to use the skill."],
"6HCOwA": ["Failed to open."],
@@ -518,6 +515,7 @@
"Adds the OpenKnowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."
],
"9Vh9Jf": ["Reopen this window to sign in with your browser"],
+ "9Vnjc9": ["Enter"],
"9XIEYq": ["Attach the file in an email to <0/>"],
"9aVlF2": ["Change provider"],
"9bCiQ8": ["No pages are missing incoming graph links."],
@@ -732,6 +730,7 @@
"DVh_Tb": ["Failed to clean up after trash"],
"DXd9LM": ["New worktree"],
"D_WKe_": ["Click an agent's avatar in the presence bar to view their session."],
+ "DbCfXV": ["Search (", ["searchShortcutLabel"], ")"],
"DbILZA": ["No matches. Some files are excluded from search (hidden or ignored files)."],
"DcLaew": ["Custom theme"],
"DeDYLr": ["Unrecognized wiki link"],
@@ -944,6 +943,11 @@
"GsBUCk": ["Loading settings"],
"Gt4gOO": ["This folder has unpushed changes. Recipients will see the last pushed version."],
"GtJbUa": ["Background"],
+ "GuLeuE": [
+ "Search matches file names, paths, and folders. Open a file to search its body <0>",
+ ["0"],
+ "</0>."
+ ],
"GuaJb-": ["Open email draft"],
"GubkSu": ["Use a starter pack"],
"GuqOb1": ["Failed to load headings"],
@@ -1004,7 +1008,6 @@
"IFezUv": ["The audit could not be completed. Try again."],
"IInnZo": ["Conflict"],
"IKoTAC": ["Keep disabled"],
- "IN4UX8": ["Search (", ["searchShortcut"], ")"],
"IQPyrD": ["Missing page — click to create"],
"IQgeSn": ["Failed to save the schema field"],
"IRv9cH": ["Cloned ", ["repoName"], "."],
@@ -1077,7 +1080,6 @@
"K9J00P": ["Clone failed — connection error"],
"KDuPiY": ["Uploading ", ["fileName"]],
"KDw4GX": ["Try again"],
- "KFdXwz": ["Show panel (", ["panelShortcut"], ")"],
"KH5bQi": [
"Using the <0>OK_EMBEDDINGS_API_KEY</0> environment variable (managed outside OpenKnowledge)."
],
@@ -1216,7 +1218,6 @@
"MZSBsh": [
"No templates yet. Add one to give new docs in this folder a ready-made starting point."
],
- "MZoxVx": ["Failed to load tags. Press Escape and re-open to retry."],
"Mb_20S": ["Visual"],
"Md709y": ["Loading ", ["fileName"]],
"MdpSC1": ["New skill"],
@@ -1228,7 +1229,6 @@
"MqQoV-": ["Describe what you want to build, start a blank file, or scaffold from a template."],
"MqsbfN": ["Turn on external link previews?"],
"MrwYIK": ["Toggle a source comment through CodeMirror."],
- "MsuXaI": ["Hide panel (", ["panelShortcut"], ")"],
"My0wYT": [
"When you hover an external link, its URL is sent to the destination site to fetch the page's preview metadata — one request per previewed link."
],
@@ -1646,6 +1646,7 @@
"</0> file, which fully governs linting for this project. Turn rules on or off and edit their options here; changes write back to the file."
],
"V48OUT": ["You deleted <0>", ["filePath"], "</0> locally, but it was modified upstream."],
+ "V6AIOn": ["Workspace navigation"],
"V7QxyT": ["Connection dropped"],
"VAHWL_": ["Connected as <0>@", ["signedInLogin"], "</0>"],
"VBE2dw": [
@@ -1738,6 +1739,7 @@
"XDzAnp": ["Opens in a new tab"],
"XH30C4": ["document"],
"XJOV1Y": ["Activity"],
+ "XK5cbh": ["Traverse OpenKnowledge navigation history forward."],
"XNBGZw": ["Message not sent: ", ["0"]],
"XPJ0sN": [["settingsDescriptorLabel"], " properties"],
"XPqe3B": ["Create new tag #", ["tagValue"]],
@@ -1772,7 +1774,6 @@
"Couldn't restart the server — another process owns it. Quit other OpenKnowledge windows for this project, then try again."
],
"Xv_ijG": ["https://github.com/owner/repo or owner/repo"],
- "Xw_maT": ["Type a query, then press ↵ to search your pages by meaning."],
"Xwump4": ["no git repository here"],
"XyOUTJ": ["Exit merge"],
"Xzy0s0": ["Remove ", ["fullLabel"], " from context"],
@@ -1880,8 +1881,6 @@
"Zue_jx": ["Your GitHub token is missing required scopes. Try signing in again."],
"Zul8Ry": ["never"],
"ZvzbDF": ["Add it directly to this project."],
- "ZxXhLY": ["Hide Files (", ["sidebarShortcut"], ")"],
- "Zz25kq": ["Show Files (", ["sidebarShortcut"], ")"],
"_0JUKX": ["Bug reporting needs the OpenKnowledge desktop app."],
"_2cM9E": ["recent"],
"_5qBNl": ["AI tools & CLI"],
@@ -2075,6 +2074,7 @@
"cdmk8A": ["Uncommitted changes"],
"cgl-gn": ["Connected to GitHub"],
"chL5IG": ["Community"],
+ "cjtjry": ["Traverse OpenKnowledge navigation history backward."],
"cklVjM": ["Timeline"],
"clJ3qM": ["Done."],
"cn1sLi": ["Couldn't connect OpenKnowledge tools to Claude Code. Please try again."],
@@ -2180,6 +2180,7 @@
"eTL5y9": ["Show selection preview"],
"eTsJYJ": ["description"],
"eVPynQ": ["Open <0><1>", ["verificationUri"], "</1><2/></0> and enter this code:"],
+ "eaHUxx": ["Files toolbar"],
"el312q": ["Install skills into"],
"emgiet": ["Authoritative content; mirrored verbatim everywhere it's referenced."],
"enPTnx": ["line ", ["displayLine"]],
@@ -2456,6 +2457,7 @@
["endpointHost"],
"</0> — most local servers ignore it. Add one only if yours needs it."
],
+ "kBNHN1": ["Navigation history"],
"kCNU4q": [
"Indexing your pages — ",
["semanticIndexedCount"],
@@ -2521,6 +2523,7 @@
"l3s5ri": ["Import"],
"l3zD7w": ["Starting the agent…"],
"l46MqT": ["Next tab"],
+ "l5J_HM": ["Type a query, then press <0>↵</0> to search your pages by meaning."],
"l6kpzR": [
"This ",
["targetNoun"],
@@ -2668,7 +2671,6 @@
"nc-ipN": [
"Field editing is available for schema files mapped in the Frontmatter schemas plugin"
],
- "ndeI89": ["Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app."],
"ndwmea": ["unavailable on this platform"],
"neRy3o": ["Split list item"],
"nfPccR": [
@@ -2813,6 +2815,7 @@
"qRZh7J": ["Let Tab leave the source editor instead of indenting."],
"qSKu2v": ["Source navigation and selection"],
"qSxaOz": ["Accept their deletion"],
+ "qTcZZu": ["Failed to load tags. Press <0>Esc</0> and re-open to retry."],
"qX-ABr": ["Or to use browser sign-in instead:"],
"qXN416": ["Couldn't share skills: internal error. Please restart the app."],
"qXg5W9": ["File saves to <0>~/Downloads/openknowledge.skill</0>."],
@@ -2848,7 +2851,6 @@
["repoName"],
"</0>."
],
- "rBc32v": ["Couldn't reach the embeddings provider — press ↵ to retry"],
"rD-woT": [
"Tell us what went wrong and we'll gather the logs. Nothing leaves your Mac until you've reviewed it."
],
@@ -2886,6 +2888,7 @@
"rssK8c": ["Ignore patterns (raw text)"],
"rtdR4v": ["Show or hide Files"],
"rwrPbS": ["Component boundary navigation"],
+ "rxWGWX": ["Forward"],
"s-MGs7": ["Resources"],
"s-XOaI": ["File name"],
"s0-xF4": ["Tell us how it's going"],
@@ -3075,12 +3078,18 @@
"vfWA_g": ["You picked ~/Desktop. OpenKnowledge will index everything on your desktop."],
"vhAnzJ": ["Turn on semantic search?"],
"viwC-K": ["Failed to remove project."],
+ "vj-33a": [
+ "Use <0>",
+ ["copyShortcut"],
+ "</0> to copy the link below, or open OK in the desktop app."
+ ],
"vja0Dg": ["Open session dock"],
"vppAju": ["Where newly added attachments are placed."],
"vv7kpg": ["Cancelled"],
"vvWZnu": ["Diff unavailable"],
"w3tVpc": ["No links yet. Add wiki links or markdown links to build a graph."],
"w3vFfL": ["Hide Files"],
+ "w4ZzmQ": ["Couldn't reach the embeddings provider — retry"],
"w4hMYl": [
"Could not read branch state for this project. Close this dialog and open the share link again."
],
@@ -3272,6 +3281,7 @@
"A <0>Modified</0> badge marks rules your config sets explicitly — directly, or inherited through <1>extends</1>. Unmarked rules keep their default state."
],
"zZ_I5K": ["Open project menu"],
+ "z_4xza": ["Failed to load docs. Press <0>Esc</0> and re-open to retry."],
"zaXlhf": [
"The properties block at the top of this doc has a formatting error. Switch to source mode to fix it."
],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index be18415a2..cba617502 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -1350,8 +1350,12 @@ msgstr "Available in every project on this computer."
msgid "Available in the OpenKnowledge desktop app. From a terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
msgstr "Available in the OpenKnowledge desktop app. From a terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
+#: src/components/AppMenubar.tsx
+#: src/components/command-palette-commands.ts
+#: src/components/NavigationHistoryControls.tsx
#: src/components/ReportBugDialogBody.tsx
#: src/components/SeedDialog.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Back"
msgstr "Back"
@@ -2613,8 +2617,8 @@ msgid "Couldn't reach the agent registry."
msgstr "Couldn't reach the agent registry."
#: src/components/CommandPalette.tsx
-msgid "Couldn't reach the embeddings provider — press ↵ to retry"
-msgstr "Couldn't reach the embeddings provider — press ↵ to retry"
+msgid "Couldn't reach the embeddings provider — retry"
+msgstr "Couldn't reach the embeddings provider — retry"
#: src/components/settings/SearchSection.tsx
msgid "Couldn't reach the endpoint. Check the URL and that the server is up."
@@ -3649,6 +3653,10 @@ msgstr "Endpoint"
msgid "Eng specs"
msgstr "Eng specs"
+#: src/components/CommandPalette.tsx
+msgid "Enter"
+msgstr "Enter"
+
#: src/components/settings/CustomThemeEditor.tsx
msgid "Enter a 6-digit hex like #1A2B3C"
msgstr "Enter a 6-digit hex like #1A2B3C"
@@ -3690,6 +3698,10 @@ msgstr "Error"
msgid "Error:"
msgstr "Error:"
+#: src/components/CommandPalette.tsx
+msgid "Escape"
+msgstr "Escape"
+
#: src/components/settings/LintingSection.tsx
msgid "every doc"
msgstr "every doc"
@@ -3882,8 +3894,8 @@ msgid "Failed to load backlinks"
msgstr "Failed to load backlinks"
#: src/components/CommandPalette.tsx
-msgid "Failed to load docs. Press Escape and re-open to retry."
-msgstr "Failed to load docs. Press Escape and re-open to retry."
+msgid "Failed to load docs. Press <0>Esc</0> and re-open to retry."
+msgstr "Failed to load docs. Press <0>Esc</0> and re-open to retry."
#: src/components/FileTree.tsx
msgid "Failed to load documents"
@@ -3946,8 +3958,8 @@ msgid "Failed to load skills: {0}"
msgstr "Failed to load skills: {0}"
#: src/components/CommandPalette.tsx
-msgid "Failed to load tags. Press Escape and re-open to retry."
-msgstr "Failed to load tags. Press Escape and re-open to retry."
+msgid "Failed to load tags. Press <0>Esc</0> and re-open to retry."
+msgstr "Failed to load tags. Press <0>Esc</0> and re-open to retry."
#: src/components/TemplatesCard.tsx
msgid "Failed to load templates: {message}"
@@ -4187,6 +4199,10 @@ msgstr "Files"
msgid "Files sidebar"
msgstr "Files sidebar"
+#: src/components/FileSidebar.tsx
+msgid "Files toolbar"
+msgstr "Files toolbar"
+
#: src/editor/extensions/CodeBlockView.tsx
msgid "Filter languages"
msgstr "Filter languages"
@@ -4372,6 +4388,13 @@ msgstr "Force stop"
msgid "Formatting looked wrong"
msgstr "Formatting looked wrong"
+#: src/components/AppMenubar.tsx
+#: src/components/command-palette-commands.ts
+#: src/components/NavigationHistoryControls.tsx
+#: src/lib/keyboard-shortcuts.ts
+msgid "Forward"
+msgstr "Forward"
+
#: src/components/LinksPanel.tsx
msgid "Forward-links response did not match expected shape."
msgstr "Forward-links response did not match expected shape."
@@ -4633,14 +4656,11 @@ msgstr "Hide document panel"
msgid "Hide external URL nodes"
msgstr "Hide external URL nodes"
+#: src/components/EditorHeader.tsx
#: src/components/ui/sidebar.tsx
msgid "Hide Files"
msgstr "Hide Files"
-#: src/components/EditorHeader.tsx
-msgid "Hide Files ({sidebarShortcut})"
-msgstr "Hide Files ({sidebarShortcut})"
-
#: src/components/ui/sidebar.tsx
msgid "Hide Files ({sidebarShortcutLabel})"
msgstr "Hide Files ({sidebarShortcutLabel})"
@@ -4658,14 +4678,11 @@ msgid "Hide HTML preview"
msgstr "Hide HTML preview"
#: src/components/AgentDiffPane.tsx
+#: src/components/EditorToolbar.tsx
#: src/components/TimelineDiffPane.tsx
msgid "Hide panel"
msgstr "Hide panel"
-#: src/components/EditorToolbar.tsx
-msgid "Hide panel ({panelShortcut})"
-msgstr "Hide panel ({panelShortcut})"
-
#: src/components/EditorToolbar.tsx
msgid "Hide panel ({panelShortcutLabel})"
msgstr "Hide panel ({panelShortcutLabel})"
@@ -5743,6 +5760,10 @@ msgstr "Navigate to {docName}"
msgid "Navigation and suggestions"
msgstr "Navigation and suggestions"
+#: src/components/NavigationHistoryControls.tsx
+msgid "Navigation history"
+msgstr "Navigation history"
+
#: src/components/settings/OkignoreSection.tsx
msgid "Nested .okignore error in {path}"
msgstr "Nested .okignore error in {path}"
@@ -7987,6 +8008,7 @@ msgid "Screenshot"
msgstr "Screenshot"
#: src/components/CommandPalette.tsx
+#: src/components/EditorHeader.tsx
#: src/components/settings/SettingsDialogShell.tsx
#: src/components/SidebarSearchBar.tsx
#: src/lib/keyboard-shortcuts.ts
@@ -7998,8 +8020,8 @@ msgid "Search \"{semanticSubmitQuery}\" by meaning"
msgstr "Search \"{semanticSubmitQuery}\" by meaning"
#: src/components/EditorHeader.tsx
-msgid "Search ({searchShortcut})"
-msgstr "Search ({searchShortcut})"
+msgid "Search ({searchShortcutLabel})"
+msgstr "Search ({searchShortcutLabel})"
#: src/components/settings/ConfigureAgentsSection.tsx
msgid "Search agents"
@@ -8037,9 +8059,10 @@ msgstr "Search files, folders, and commands for the current workspace."
msgid "Search files, folders, or commands"
msgstr "Search files, folders, or commands"
+#. placeholder {0}: formatShortcut('find')
#: src/components/CommandPalette.tsx
-msgid "Search matches file names, paths, and folders. Open a file to search its body (⌘F)."
-msgstr "Search matches file names, paths, and folders. Open a file to search its body (⌘F)."
+msgid "Search matches file names, paths, and folders. Open a file to search its body <0>{0}</0>."
+msgstr "Search matches file names, paths, and folders. Open a file to search its body <0>{0}</0>."
#: src/components/ProjectSwitcher.tsx
msgid "Search projects"
@@ -8465,14 +8488,11 @@ msgstr "Show external URL nodes"
msgid "Show fewer"
msgstr "Show fewer"
+#: src/components/EditorHeader.tsx
#: src/components/ui/sidebar.tsx
msgid "Show Files"
msgstr "Show Files"
-#: src/components/EditorHeader.tsx
-msgid "Show Files ({sidebarShortcut})"
-msgstr "Show Files ({sidebarShortcut})"
-
#: src/components/ui/sidebar.tsx
msgid "Show Files ({sidebarShortcutLabel})"
msgstr "Show Files ({sidebarShortcutLabel})"
@@ -8520,14 +8540,11 @@ msgid "Show or hide terminal"
msgstr "Show or hide terminal"
#: src/components/AgentDiffPane.tsx
+#: src/components/EditorToolbar.tsx
#: src/components/TimelineDiffPane.tsx
msgid "Show panel"
msgstr "Show panel"
-#: src/components/EditorToolbar.tsx
-msgid "Show panel ({panelShortcut})"
-msgstr "Show panel ({panelShortcut})"
-
#: src/components/EditorToolbar.tsx
msgid "Show panel ({panelShortcutLabel})"
msgstr "Show panel ({panelShortcutLabel})"
@@ -9795,6 +9812,14 @@ msgstr "Too slow"
msgid "Top linked pages"
msgstr "Top linked pages"
+#: src/lib/keyboard-shortcuts.ts
+msgid "Traverse OpenKnowledge navigation history backward."
+msgstr "Traverse OpenKnowledge navigation history backward."
+
+#: src/lib/keyboard-shortcuts.ts
+msgid "Traverse OpenKnowledge navigation history forward."
+msgstr "Traverse OpenKnowledge navigation history forward."
+
#: src/components/FileSidebar.tsx
msgid "Tree view options"
msgstr "Tree view options"
@@ -9851,8 +9876,8 @@ msgid "Type"
msgstr "Type"
#: src/components/CommandPalette.tsx
-msgid "Type a query, then press ↵ to search your pages by meaning."
-msgstr "Type a query, then press ↵ to search your pages by meaning."
+msgid "Type a query, then press <0>↵</0> to search your pages by meaning."
+msgstr "Type a query, then press <0>↵</0> to search your pages by meaning."
#: src/editor/components/CodePreviewEditModal.tsx
msgid "Type to edit; <0>⌘ Enter</0> saves, <1>Esc</1> cancels."
@@ -10092,6 +10117,10 @@ msgstr "Uploading securely"
msgid "Upstream sync"
msgstr "Upstream sync"
+#: src/components/ShareButton.tsx
+msgid "Use <0>{copyShortcut}</0> to copy the link below, or open OK in the desktop app."
+msgstr "Use <0>{copyShortcut}</0> to copy the link below, or open OK in the desktop app."
+
#: src/components/NavigatorApp.tsx
msgid "Use a folder you already have."
msgstr "Use a folder you already have."
@@ -10108,10 +10137,6 @@ msgstr "Use a token instead"
msgid "Use an https:// URL — http:// is only allowed for localhost."
msgstr "Use an https:// URL — http:// is only allowed for localhost."
-#: src/components/ShareButton.tsx
-msgid "Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app."
-msgstr "Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app."
-
#: src/components/TemplateProperties.tsx
msgid "Use letters, digits, <0>_</0> and <1>-</1> only."
msgstr "Use letters, digits, <0>_</0> and <1>-</1> only."
@@ -10401,6 +10426,10 @@ msgstr "Workspace"
msgid "Workspace Command Palette"
msgstr "Workspace Command Palette"
+#: src/components/EditorHeader.tsx
+msgid "Workspace navigation"
+msgstr "Workspace navigation"
+
#: src/components/NavigatorApp.tsx
msgid "worktree"
msgstr "worktree"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index e7a754506..6d55e34c1 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -37,9 +37,6 @@
"-r_Kx7": ["Ćŕēàţē śķĩĺĺ"],
"-slrNR": ["Ţōĝĝĺē à ţàśķ ĺĩśţ."],
"-uaQnI": ["Ńō ḿàţćĥĩńĝ ŵōŕķţŕēēś ōŕ ƀŕàńćĥēś."],
- "-wePNM": [
- "Śēàŕćĥ ḿàţćĥēś ƒĩĺē ńàḿēś, ƥàţĥś, àńď ƒōĺďēŕś. Ōƥēń à ƒĩĺē ţō śēàŕćĥ ĩţś ƀōďŷ (⌘Ƒ)."
- ],
"-zA2E7": ["Ćōũĺďń'ţ ćŕēàţē ţĥē ŵōŕķţŕēē. Ţŕŷ à ďĩƒƒēŕēńţ ńàḿē."],
"-zy2Nq": ["Ţŷƥē"],
"0-31GV": ["Ŕēḿōvĩńĝ"],
@@ -241,7 +238,6 @@
"). Àńŷ ĺōćàĺ ēďĩţś ŵĩĺĺ ƀē ŕēƥĺàćēď — ŷōũŕ ćũŕŕēńţ vēŕśĩōń ĩś śàvēď ţō ĥĩśţōŕŷ ƒĩŕśţ, śō ŷōũ ćàń ŕēśţōŕē ĩţ."
],
"484LKL": ["Ŕēḿōvē ĺĩńķ"],
- "48uGTI": ["Ƒàĩĺēď ţō ĺōàď ďōćś. Ƥŕēśś Ēśćàƥē àńď ŕē-ōƥēń ţō ŕēţŕŷ."],
"494br3": ["Śĥàŕēď ŵĩţĥ ēvēŕŷōńē ōń ţĥĩś ƥŕōĴēćţ — ćōḿḿĩţţēď ţō ćōńƒĩĝ.ŷḿĺ vĩà ĝĩţ."],
"4A3Yzu": ["Ćōďē ƀĺōćķ"],
"4BITzH": ["Ēŕŕōŕ:"],
@@ -360,6 +356,7 @@
"62bOuM": ["Ĺàţēśţ ēďĩţ"],
"636K3K": ["Ďēĺēţē àďĴàćēńţ ćĥĩƥ"],
"67f-3g": ["Ďũƥĺĩćàţē śũććēēďēď ƀũţ ţĥē śĩďēƀàŕ ḿàŷ ƀē ōũţ ōƒ ďàţē — ŕēƒŕēśĥ ţō ŕēśŷńć"],
+ "69KLIV": ["Ēśćàƥē"],
"6Aih4U": ["Ōƒƒĺĩńē"],
"6EKG_c": ["Ŵĥàţ àĝēńţś ḿàţćĥ ōń ţō ďēćĩďē ŵĥēń ţō ũśē ţĥē śķĩĺĺ."],
"6HCOwA": ["Ƒàĩĺēď ţō ōƥēń."],
@@ -518,6 +515,7 @@
"Àďďś ţĥē ŌƥēńĶńōŵĺēďĝē śķĩĺĺ ţō ţĥē <0>Ćĺàũďē Ďēśķţōƥ Àƥƥ</0> śō ĩţ'ś àvàĩĺàƀĺē ĩń Ćĥàţ àńď Ćōŵōŕķ śēśśĩōńś."
],
"9Vh9Jf": ["Ŕēōƥēń ţĥĩś ŵĩńďōŵ ţō śĩĝń ĩń ŵĩţĥ ŷōũŕ ƀŕōŵśēŕ"],
+ "9Vnjc9": ["Ēńţēŕ"],
"9XIEYq": ["Àţţàćĥ ţĥē ƒĩĺē ĩń àń ēḿàĩĺ ţō <0/>"],
"9aVlF2": ["Ćĥàńĝē ƥŕōvĩďēŕ"],
"9bCiQ8": ["Ńō ƥàĝēś àŕē ḿĩśśĩńĝ ĩńćōḿĩńĝ ĝŕàƥĥ ĺĩńķś."],
@@ -732,6 +730,7 @@
"DVh_Tb": ["Ƒàĩĺēď ţō ćĺēàń ũƥ àƒţēŕ ţŕàśĥ"],
"DXd9LM": ["Ńēŵ ŵōŕķţŕēē"],
"D_WKe_": ["Ćĺĩćķ àń àĝēńţ'ś àvàţàŕ ĩń ţĥē ƥŕēśēńćē ƀàŕ ţō vĩēŵ ţĥēĩŕ śēśśĩōń."],
+ "DbCfXV": ["Śēàŕćĥ (", ["searchShortcutLabel"], ")"],
"DbILZA": ["Ńō ḿàţćĥēś. Śōḿē ƒĩĺēś àŕē ēxćĺũďēď ƒŕōḿ śēàŕćĥ (ĥĩďďēń ōŕ ĩĝńōŕēď ƒĩĺēś)."],
"DcLaew": ["Ćũśţōḿ ţĥēḿē"],
"DeDYLr": ["Ũńŕēćōĝńĩźēď ŵĩķĩ ĺĩńķ"],
@@ -944,6 +943,11 @@
"GsBUCk": ["Ĺōàďĩńĝ śēţţĩńĝś"],
"Gt4gOO": ["Ţĥĩś ƒōĺďēŕ ĥàś ũńƥũśĥēď ćĥàńĝēś. Ŕēćĩƥĩēńţś ŵĩĺĺ śēē ţĥē ĺàśţ ƥũśĥēď vēŕśĩōń."],
"GtJbUa": ["ßàćķĝŕōũńď"],
+ "GuLeuE": [
+ "Śēàŕćĥ ḿàţćĥēś ƒĩĺē ńàḿēś, ƥàţĥś, àńď ƒōĺďēŕś. Ōƥēń à ƒĩĺē ţō śēàŕćĥ ĩţś ƀōďŷ <0>",
+ ["0"],
+ "</0>."
+ ],
"GuaJb-": ["Ōƥēń ēḿàĩĺ ďŕàƒţ"],
"GubkSu": ["Ũśē à śţàŕţēŕ ƥàćķ"],
"GuqOb1": ["Ƒàĩĺēď ţō ĺōàď ĥēàďĩńĝś"],
@@ -1004,7 +1008,6 @@
"IFezUv": ["Ţĥē àũďĩţ ćōũĺď ńōţ ƀē ćōḿƥĺēţēď. Ţŕŷ àĝàĩń."],
"IInnZo": ["Ćōńƒĺĩćţ"],
"IKoTAC": ["Ķēēƥ ďĩśàƀĺēď"],
- "IN4UX8": ["Śēàŕćĥ (", ["searchShortcut"], ")"],
"IQPyrD": ["Ḿĩśśĩńĝ ƥàĝē — ćĺĩćķ ţō ćŕēàţē"],
"IQgeSn": ["Ƒàĩĺēď ţō śàvē ţĥē śćĥēḿà ƒĩēĺď"],
"IRv9cH": ["Ćĺōńēď ", ["repoName"], "."],
@@ -1077,7 +1080,6 @@
"K9J00P": ["Ćĺōńē ƒàĩĺēď — ćōńńēćţĩōń ēŕŕōŕ"],
"KDuPiY": ["Ũƥĺōàďĩńĝ ", ["fileName"]],
"KDw4GX": ["Ţŕŷ àĝàĩń"],
- "KFdXwz": ["Śĥōŵ ƥàńēĺ (", ["panelShortcut"], ")"],
"KH5bQi": [
"Ũśĩńĝ ţĥē <0>ŌĶ_ĒḾßĒĎĎĨŃĜŚ_ÀƤĨ_ĶĒŶ</0> ēńvĩŕōńḿēńţ vàŕĩàƀĺē (ḿàńàĝēď ōũţśĩďē ŌƥēńĶńōŵĺēďĝē)."
],
@@ -1216,7 +1218,6 @@
"MZSBsh": [
"Ńō ţēḿƥĺàţēś ŷēţ. Àďď ōńē ţō ĝĩvē ńēŵ ďōćś ĩń ţĥĩś ƒōĺďēŕ à ŕēàďŷ-ḿàďē śţàŕţĩńĝ ƥōĩńţ."
],
- "MZoxVx": ["Ƒàĩĺēď ţō ĺōàď ţàĝś. Ƥŕēśś Ēśćàƥē àńď ŕē-ōƥēń ţō ŕēţŕŷ."],
"Mb_20S": ["Vĩśũàĺ"],
"Md709y": ["Ĺōàďĩńĝ ", ["fileName"]],
"MdpSC1": ["Ńēŵ śķĩĺĺ"],
@@ -1228,7 +1229,6 @@
"MqQoV-": ["Ďēśćŕĩƀē ŵĥàţ ŷōũ ŵàńţ ţō ƀũĩĺď, śţàŕţ à ƀĺàńķ ƒĩĺē, ōŕ śćàƒƒōĺď ƒŕōḿ à ţēḿƥĺàţē."],
"MqsbfN": ["Ţũŕń ōń ēxţēŕńàĺ ĺĩńķ ƥŕēvĩēŵś?"],
"MrwYIK": ["Ţōĝĝĺē à śōũŕćē ćōḿḿēńţ ţĥŕōũĝĥ ĆōďēḾĩŕŕōŕ."],
- "MsuXaI": ["Ĥĩďē ƥàńēĺ (", ["panelShortcut"], ")"],
"My0wYT": [
"Ŵĥēń ŷōũ ĥōvēŕ àń ēxţēŕńàĺ ĺĩńķ, ĩţś ŨŔĹ ĩś śēńţ ţō ţĥē ďēśţĩńàţĩōń śĩţē ţō ƒēţćĥ ţĥē ƥàĝē'ś ƥŕēvĩēŵ ḿēţàďàţà — ōńē ŕēǫũēśţ ƥēŕ ƥŕēvĩēŵēď ĺĩńķ."
],
@@ -1646,6 +1646,7 @@
"</0> ƒĩĺē, ŵĥĩćĥ ƒũĺĺŷ ĝōvēŕńś ĺĩńţĩńĝ ƒōŕ ţĥĩś ƥŕōĴēćţ. Ţũŕń ŕũĺēś ōń ōŕ ōƒƒ àńď ēďĩţ ţĥēĩŕ ōƥţĩōńś ĥēŕē; ćĥàńĝēś ŵŕĩţē ƀàćķ ţō ţĥē ƒĩĺē."
],
"V48OUT": ["Ŷōũ ďēĺēţēď <0>", ["filePath"], "</0> ĺōćàĺĺŷ, ƀũţ ĩţ ŵàś ḿōďĩƒĩēď ũƥśţŕēàḿ."],
+ "V6AIOn": ["Ŵōŕķśƥàćē ńàvĩĝàţĩōń"],
"V7QxyT": ["Ćōńńēćţĩōń ďŕōƥƥēď"],
"VAHWL_": ["Ćōńńēćţēď àś <0>@", ["signedInLogin"], "</0>"],
"VBE2dw": [
@@ -1738,6 +1739,7 @@
"XDzAnp": ["Ōƥēńś ĩń à ńēŵ ţàƀ"],
"XH30C4": ["ďōćũḿēńţ"],
"XJOV1Y": ["Àćţĩvĩţŷ"],
+ "XK5cbh": ["Ţŕàvēŕśē ŌƥēńĶńōŵĺēďĝē ńàvĩĝàţĩōń ĥĩśţōŕŷ ƒōŕŵàŕď."],
"XNBGZw": ["Ḿēśśàĝē ńōţ śēńţ: ", ["0"]],
"XPJ0sN": [["settingsDescriptorLabel"], " ƥŕōƥēŕţĩēś"],
"XPqe3B": ["Ćŕēàţē ńēŵ ţàĝ #", ["tagValue"]],
@@ -1772,7 +1774,6 @@
"Ćōũĺďń'ţ ŕēśţàŕţ ţĥē śēŕvēŕ — àńōţĥēŕ ƥŕōćēśś ōŵńś ĩţ. Ǫũĩţ ōţĥēŕ ŌƥēńĶńōŵĺēďĝē ŵĩńďōŵś ƒōŕ ţĥĩś ƥŕōĴēćţ, ţĥēń ţŕŷ àĝàĩń."
],
"Xv_ijG": ["ĥţţƥś://ĝĩţĥũƀ.ćōḿ/ōŵńēŕ/ŕēƥō ōŕ ōŵńēŕ/ŕēƥō"],
- "Xw_maT": ["Ţŷƥē à ǫũēŕŷ, ţĥēń ƥŕēśś ↵ ţō śēàŕćĥ ŷōũŕ ƥàĝēś ƀŷ ḿēàńĩńĝ."],
"Xwump4": ["ńō ĝĩţ ŕēƥōśĩţōŕŷ ĥēŕē"],
"XyOUTJ": ["Ēxĩţ ḿēŕĝē"],
"Xzy0s0": ["Ŕēḿōvē ", ["fullLabel"], " ƒŕōḿ ćōńţēxţ"],
@@ -1880,8 +1881,6 @@
"Zue_jx": ["Ŷōũŕ ĜĩţĤũƀ ţōķēń ĩś ḿĩśśĩńĝ ŕēǫũĩŕēď śćōƥēś. Ţŕŷ śĩĝńĩńĝ ĩń àĝàĩń."],
"Zul8Ry": ["ńēvēŕ"],
"ZvzbDF": ["Àďď ĩţ ďĩŕēćţĺŷ ţō ţĥĩś ƥŕōĴēćţ."],
- "ZxXhLY": ["Ĥĩďē Ƒĩĺēś (", ["sidebarShortcut"], ")"],
- "Zz25kq": ["Śĥōŵ Ƒĩĺēś (", ["sidebarShortcut"], ")"],
"_0JUKX": ["ßũĝ ŕēƥōŕţĩńĝ ńēēďś ţĥē ŌƥēńĶńōŵĺēďĝē ďēśķţōƥ àƥƥ."],
"_2cM9E": ["ŕēćēńţ"],
"_5qBNl": ["ÀĨ ţōōĺś & ĆĹĨ"],
@@ -2075,6 +2074,7 @@
"cdmk8A": ["Ũńćōḿḿĩţţēď ćĥàńĝēś"],
"cgl-gn": ["Ćōńńēćţēď ţō ĜĩţĤũƀ"],
"chL5IG": ["Ćōḿḿũńĩţŷ"],
+ "cjtjry": ["Ţŕàvēŕśē ŌƥēńĶńōŵĺēďĝē ńàvĩĝàţĩōń ĥĩśţōŕŷ ƀàćķŵàŕď."],
"cklVjM": ["Ţĩḿēĺĩńē"],
"clJ3qM": ["Ďōńē."],
"cn1sLi": ["Ćōũĺďń'ţ ćōńńēćţ ŌƥēńĶńōŵĺēďĝē ţōōĺś ţō Ćĺàũďē Ćōďē. Ƥĺēàśē ţŕŷ àĝàĩń."],
@@ -2180,6 +2180,7 @@
"eTL5y9": ["Śĥōŵ śēĺēćţĩōń ƥŕēvĩēŵ"],
"eTsJYJ": ["ďēśćŕĩƥţĩōń"],
"eVPynQ": ["Ōƥēń <0><1>", ["verificationUri"], "</1><2/></0> àńď ēńţēŕ ţĥĩś ćōďē:"],
+ "eaHUxx": ["Ƒĩĺēś ţōōĺƀàŕ"],
"el312q": ["Ĩńśţàĺĺ śķĩĺĺś ĩńţō"],
"emgiet": ["Àũţĥōŕĩţàţĩvē ćōńţēńţ; ḿĩŕŕōŕēď vēŕƀàţĩḿ ēvēŕŷŵĥēŕē ĩţ'ś ŕēƒēŕēńćēď."],
"enPTnx": ["ĺĩńē ", ["displayLine"]],
@@ -2456,6 +2457,7 @@
["endpointHost"],
"</0> — ḿōśţ ĺōćàĺ śēŕvēŕś ĩĝńōŕē ĩţ. Àďď ōńē ōńĺŷ ĩƒ ŷōũŕś ńēēďś ĩţ."
],
+ "kBNHN1": ["Ńàvĩĝàţĩōń ĥĩśţōŕŷ"],
"kCNU4q": [
"Ĩńďēxĩńĝ ŷōũŕ ƥàĝēś — ",
["semanticIndexedCount"],
@@ -2521,6 +2523,7 @@
"l3s5ri": ["Ĩḿƥōŕţ"],
"l3zD7w": ["Śţàŕţĩńĝ ţĥē àĝēńţ…"],
"l46MqT": ["Ńēxţ ţàƀ"],
+ "l5J_HM": ["Ţŷƥē à ǫũēŕŷ, ţĥēń ƥŕēśś <0>↵</0> ţō śēàŕćĥ ŷōũŕ ƥàĝēś ƀŷ ḿēàńĩńĝ."],
"l6kpzR": [
"Ţĥĩś ",
["targetNoun"],
@@ -2668,7 +2671,6 @@
"nc-ipN": [
"Ƒĩēĺď ēďĩţĩńĝ ĩś àvàĩĺàƀĺē ƒōŕ śćĥēḿà ƒĩĺēś ḿàƥƥēď ĩń ţĥē Ƒŕōńţḿàţţēŕ śćĥēḿàś ƥĺũĝĩń"
],
- "ndeI89": ["Ũśē Ćḿď/Ćţŕĺ+Ć ţō ćōƥŷ ţĥē ĺĩńķ ƀēĺōŵ, ōŕ ōƥēń ŌĶ ĩń ţĥē ďēśķţōƥ àƥƥ."],
"ndwmea": ["ũńàvàĩĺàƀĺē ōń ţĥĩś ƥĺàţƒōŕḿ"],
"neRy3o": ["Śƥĺĩţ ĺĩśţ ĩţēḿ"],
"nfPccR": [
@@ -2813,6 +2815,7 @@
"qRZh7J": ["Ĺēţ Ţàƀ ĺēàvē ţĥē śōũŕćē ēďĩţōŕ ĩńśţēàď ōƒ ĩńďēńţĩńĝ."],
"qSKu2v": ["Śōũŕćē ńàvĩĝàţĩōń àńď śēĺēćţĩōń"],
"qSxaOz": ["Àććēƥţ ţĥēĩŕ ďēĺēţĩōń"],
+ "qTcZZu": ["Ƒàĩĺēď ţō ĺōàď ţàĝś. Ƥŕēśś <0>Ēść</0> àńď ŕē-ōƥēń ţō ŕēţŕŷ."],
"qX-ABr": ["Ōŕ ţō ũśē ƀŕōŵśēŕ śĩĝń-ĩń ĩńśţēàď:"],
"qXN416": ["Ćōũĺďń'ţ śĥàŕē śķĩĺĺś: ĩńţēŕńàĺ ēŕŕōŕ. Ƥĺēàśē ŕēśţàŕţ ţĥē àƥƥ."],
"qXg5W9": ["Ƒĩĺē śàvēś ţō <0>~/Ďōŵńĺōàďś/ōƥēńķńōŵĺēďĝē.śķĩĺĺ</0>."],
@@ -2848,7 +2851,6 @@
["repoName"],
"</0>."
],
- "rBc32v": ["Ćōũĺďń'ţ ŕēàćĥ ţĥē ēḿƀēďďĩńĝś ƥŕōvĩďēŕ — ƥŕēśś ↵ ţō ŕēţŕŷ"],
"rD-woT": [
"Ţēĺĺ ũś ŵĥàţ ŵēńţ ŵŕōńĝ àńď ŵē'ĺĺ ĝàţĥēŕ ţĥē ĺōĝś. Ńōţĥĩńĝ ĺēàvēś ŷōũŕ Ḿàć ũńţĩĺ ŷōũ'vē ŕēvĩēŵēď ĩţ."
],
@@ -2886,6 +2888,7 @@
"rssK8c": ["Ĩĝńōŕē ƥàţţēŕńś (ŕàŵ ţēxţ)"],
"rtdR4v": ["Śĥōŵ ōŕ ĥĩďē Ƒĩĺēś"],
"rwrPbS": ["Ćōḿƥōńēńţ ƀōũńďàŕŷ ńàvĩĝàţĩōń"],
+ "rxWGWX": ["Ƒōŕŵàŕď"],
"s-MGs7": ["Ŕēśōũŕćēś"],
"s-XOaI": ["Ƒĩĺē ńàḿē"],
"s0-xF4": ["Ţēĺĺ ũś ĥōŵ ĩţ'ś ĝōĩńĝ"],
@@ -3075,12 +3078,18 @@
"vfWA_g": ["Ŷōũ ƥĩćķēď ~/Ďēśķţōƥ. ŌƥēńĶńōŵĺēďĝē ŵĩĺĺ ĩńďēx ēvēŕŷţĥĩńĝ ōń ŷōũŕ ďēśķţōƥ."],
"vhAnzJ": ["Ţũŕń ōń śēḿàńţĩć śēàŕćĥ?"],
"viwC-K": ["Ƒàĩĺēď ţō ŕēḿōvē ƥŕōĴēćţ."],
+ "vj-33a": [
+ "Ũśē <0>",
+ ["copyShortcut"],
+ "</0> ţō ćōƥŷ ţĥē ĺĩńķ ƀēĺōŵ, ōŕ ōƥēń ŌĶ ĩń ţĥē ďēśķţōƥ àƥƥ."
+ ],
"vja0Dg": ["Ōƥēń śēśśĩōń ďōćķ"],
"vppAju": ["Ŵĥēŕē ńēŵĺŷ àďďēď àţţàćĥḿēńţś àŕē ƥĺàćēď."],
"vv7kpg": ["Ćàńćēĺĺēď"],
"vvWZnu": ["Ďĩƒƒ ũńàvàĩĺàƀĺē"],
"w3tVpc": ["Ńō ĺĩńķś ŷēţ. Àďď ŵĩķĩ ĺĩńķś ōŕ ḿàŕķďōŵń ĺĩńķś ţō ƀũĩĺď à ĝŕàƥĥ."],
"w3vFfL": ["Ĥĩďē Ƒĩĺēś"],
+ "w4ZzmQ": ["Ćōũĺďń'ţ ŕēàćĥ ţĥē ēḿƀēďďĩńĝś ƥŕōvĩďēŕ — ŕēţŕŷ"],
"w4hMYl": [
"Ćōũĺď ńōţ ŕēàď ƀŕàńćĥ śţàţē ƒōŕ ţĥĩś ƥŕōĴēćţ. Ćĺōśē ţĥĩś ďĩàĺōĝ àńď ōƥēń ţĥē śĥàŕē ĺĩńķ àĝàĩń."
],
@@ -3272,6 +3281,7 @@
"À <0>Ḿōďĩƒĩēď</0> ƀàďĝē ḿàŕķś ŕũĺēś ŷōũŕ ćōńƒĩĝ śēţś ēxƥĺĩćĩţĺŷ — ďĩŕēćţĺŷ, ōŕ ĩńĥēŕĩţēď ţĥŕōũĝĥ <1>ēxţēńďś</1>. Ũńḿàŕķēď ŕũĺēś ķēēƥ ţĥēĩŕ ďēƒàũĺţ śţàţē."
],
"zZ_I5K": ["Ōƥēń ƥŕōĴēćţ ḿēńũ"],
+ "z_4xza": ["Ƒàĩĺēď ţō ĺōàď ďōćś. Ƥŕēśś <0>Ēść</0> àńď ŕē-ōƥēń ţō ŕēţŕŷ."],
"zaXlhf": [
"Ţĥē ƥŕōƥēŕţĩēś ƀĺōćķ àţ ţĥē ţōƥ ōƒ ţĥĩś ďōć ĥàś à ƒōŕḿàţţĩńĝ ēŕŕōŕ. Śŵĩţćĥ ţō śōũŕćē ḿōďē ţō ƒĩx ĩţ."
],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index 5e95ae050..b7e366a22 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -1346,8 +1346,12 @@ msgstr ""
msgid "Available in the OpenKnowledge desktop app. From a terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."
msgstr ""
+#: src/components/AppMenubar.tsx
+#: src/components/command-palette-commands.ts
+#: src/components/NavigationHistoryControls.tsx
#: src/components/ReportBugDialogBody.tsx
#: src/components/SeedDialog.tsx
+#: src/lib/keyboard-shortcuts.ts
msgid "Back"
msgstr ""
@@ -2609,7 +2613,7 @@ msgid "Couldn't reach the agent registry."
msgstr ""
#: src/components/CommandPalette.tsx
-msgid "Couldn't reach the embeddings provider — press ↵ to retry"
+msgid "Couldn't reach the embeddings provider — retry"
msgstr ""
#: src/components/settings/SearchSection.tsx
@@ -3645,6 +3649,10 @@ msgstr ""
msgid "Eng specs"
msgstr ""
+#: src/components/CommandPalette.tsx
+msgid "Enter"
+msgstr ""
+
#: src/components/settings/CustomThemeEditor.tsx
msgid "Enter a 6-digit hex like #1A2B3C"
msgstr ""
@@ -3686,6 +3694,10 @@ msgstr ""
msgid "Error:"
msgstr ""
+#: src/components/CommandPalette.tsx
+msgid "Escape"
+msgstr ""
+
#: src/components/settings/LintingSection.tsx
msgid "every doc"
msgstr ""
@@ -3878,7 +3890,7 @@ msgid "Failed to load backlinks"
msgstr ""
#: src/components/CommandPalette.tsx
-msgid "Failed to load docs. Press Escape and re-open to retry."
+msgid "Failed to load docs. Press <0>Esc</0> and re-open to retry."
msgstr ""
#: src/components/FileTree.tsx
@@ -3942,7 +3954,7 @@ msgid "Failed to load skills: {0}"
msgstr ""
#: src/components/CommandPalette.tsx
-msgid "Failed to load tags. Press Escape and re-open to retry."
+msgid "Failed to load tags. Press <0>Esc</0> and re-open to retry."
msgstr ""
#: src/components/TemplatesCard.tsx
@@ -4183,6 +4195,10 @@ msgstr ""
msgid "Files sidebar"
msgstr ""
+#: src/components/FileSidebar.tsx
+msgid "Files toolbar"
+msgstr ""
+
#: src/editor/extensions/CodeBlockView.tsx
msgid "Filter languages"
msgstr ""
@@ -4368,6 +4384,13 @@ msgstr ""
msgid "Formatting looked wrong"
msgstr ""
+#: src/components/AppMenubar.tsx
+#: src/components/command-palette-commands.ts
+#: src/components/NavigationHistoryControls.tsx
+#: src/lib/keyboard-shortcuts.ts
+msgid "Forward"
+msgstr ""
+
#: src/components/LinksPanel.tsx
msgid "Forward-links response did not match expected shape."
msgstr ""
@@ -4629,14 +4652,11 @@ msgstr ""
msgid "Hide external URL nodes"
msgstr ""
+#: src/components/EditorHeader.tsx
#: src/components/ui/sidebar.tsx
msgid "Hide Files"
msgstr ""
-#: src/components/EditorHeader.tsx
-msgid "Hide Files ({sidebarShortcut})"
-msgstr ""
-
#: src/components/ui/sidebar.tsx
msgid "Hide Files ({sidebarShortcutLabel})"
msgstr ""
@@ -4654,14 +4674,11 @@ msgid "Hide HTML preview"
msgstr ""
#: src/components/AgentDiffPane.tsx
+#: src/components/EditorToolbar.tsx
#: src/components/TimelineDiffPane.tsx
msgid "Hide panel"
msgstr ""
-#: src/components/EditorToolbar.tsx
-msgid "Hide panel ({panelShortcut})"
-msgstr ""
-
#: src/components/EditorToolbar.tsx
msgid "Hide panel ({panelShortcutLabel})"
msgstr ""
@@ -5739,6 +5756,10 @@ msgstr ""
msgid "Navigation and suggestions"
msgstr ""
+#: src/components/NavigationHistoryControls.tsx
+msgid "Navigation history"
+msgstr ""
+
#: src/components/settings/OkignoreSection.tsx
msgid "Nested .okignore error in {path}"
msgstr ""
@@ -7983,6 +8004,7 @@ msgid "Screenshot"
msgstr ""
#: src/components/CommandPalette.tsx
+#: src/components/EditorHeader.tsx
#: src/components/settings/SettingsDialogShell.tsx
#: src/components/SidebarSearchBar.tsx
#: src/lib/keyboard-shortcuts.ts
@@ -7994,7 +8016,7 @@ msgid "Search \"{semanticSubmitQuery}\" by meaning"
msgstr ""
#: src/components/EditorHeader.tsx
-msgid "Search ({searchShortcut})"
+msgid "Search ({searchShortcutLabel})"
msgstr ""
#: src/components/settings/ConfigureAgentsSection.tsx
@@ -8033,8 +8055,9 @@ msgstr ""
msgid "Search files, folders, or commands"
msgstr ""
+#. placeholder {0}: formatShortcut('find')
#: src/components/CommandPalette.tsx
-msgid "Search matches file names, paths, and folders. Open a file to search its body (⌘F)."
+msgid "Search matches file names, paths, and folders. Open a file to search its body <0>{0}</0>."
msgstr ""
#: src/components/ProjectSwitcher.tsx
@@ -8461,14 +8484,11 @@ msgstr ""
msgid "Show fewer"
msgstr ""
+#: src/components/EditorHeader.tsx
#: src/components/ui/sidebar.tsx
msgid "Show Files"
msgstr ""
-#: src/components/EditorHeader.tsx
-msgid "Show Files ({sidebarShortcut})"
-msgstr ""
-
#: src/components/ui/sidebar.tsx
msgid "Show Files ({sidebarShortcutLabel})"
msgstr ""
@@ -8516,14 +8536,11 @@ msgid "Show or hide terminal"
msgstr ""
#: src/components/AgentDiffPane.tsx
+#: src/components/EditorToolbar.tsx
#: src/components/TimelineDiffPane.tsx
msgid "Show panel"
msgstr ""
-#: src/components/EditorToolbar.tsx
-msgid "Show panel ({panelShortcut})"
-msgstr ""
-
#: src/components/EditorToolbar.tsx
msgid "Show panel ({panelShortcutLabel})"
msgstr ""
@@ -9791,6 +9808,14 @@ msgstr ""
msgid "Top linked pages"
msgstr ""
+#: src/lib/keyboard-shortcuts.ts
+msgid "Traverse OpenKnowledge navigation history backward."
+msgstr ""
+
+#: src/lib/keyboard-shortcuts.ts
+msgid "Traverse OpenKnowledge navigation history forward."
+msgstr ""
+
#: src/components/FileSidebar.tsx
msgid "Tree view options"
msgstr ""
@@ -9847,7 +9872,7 @@ msgid "Type"
msgstr ""
#: src/components/CommandPalette.tsx
-msgid "Type a query, then press ↵ to search your pages by meaning."
+msgid "Type a query, then press <0>↵</0> to search your pages by meaning."
msgstr ""
#: src/editor/components/CodePreviewEditModal.tsx
@@ -10088,6 +10113,10 @@ msgstr ""
msgid "Upstream sync"
msgstr ""
+#: src/components/ShareButton.tsx
+msgid "Use <0>{copyShortcut}</0> to copy the link below, or open OK in the desktop app."
+msgstr ""
+
#: src/components/NavigatorApp.tsx
msgid "Use a folder you already have."
msgstr ""
@@ -10104,10 +10133,6 @@ msgstr ""
msgid "Use an https:// URL — http:// is only allowed for localhost."
msgstr ""
-#: src/components/ShareButton.tsx
-msgid "Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app."
-msgstr ""
-
#: src/components/TemplateProperties.tsx
msgid "Use letters, digits, <0>_</0> and <1>-</1> only."
msgstr ""
@@ -10397,6 +10422,10 @@ msgstr ""
msgid "Workspace Command Palette"
msgstr ""
+#: src/components/EditorHeader.tsx
+msgid "Workspace navigation"
+msgstr ""
+
#: src/components/NavigatorApp.tsx
msgid "worktree"
msgstr ""
diff --git a/packages/app/tests/stress/navigation-history.e2e.ts b/packages/app/tests/stress/navigation-history.e2e.ts
new file mode 100644
index 000000000..c546e3018
--- /dev/null
+++ b/packages/app/tests/stress/navigation-history.e2e.ts
@@ -0,0 +1,203 @@
+import { randomUUID } from 'node:crypto';
+import { rmSync, writeFileSync } from 'node:fs';
+import { join } from 'node:path';
+import type { Page } from '@playwright/test';
+import { createPngBuffer, expect, test } from './_helpers';
+
+function sidebarTreeItem(page: Page, name: string) {
+ return page
+ .locator('[data-slot="sidebar-container"]')
+ .getByRole('treeitem', { name, exact: true });
+}
+
+async function expectHash(page: Page, expected: string): Promise<void> {
+ await expect
+ .poll(async () => decodeURIComponent(await page.evaluate(() => window.location.hash)), {
+ timeout: 15_000,
+ })
+ .toBe(expected);
+}
+
+async function expectDocument(page: Page, hash: string, marker: string): Promise<void> {
+ await expectHash(page, hash);
+ await expect(
+ page.locator('.ProseMirror:not(.composer-prosemirror)', { hasText: marker }),
+ ).toBeVisible({ timeout: 15_000 });
+}
+
+async function expectFolder(page: Page, hash: string, folderName: string): Promise<void> {
+ await expectHash(page, hash);
+ await expect(
+ page
+ .locator('[data-active-tab="true"]')
+ .getByRole('button', { name: `${folderName}/`, exact: true }),
+ ).toBeVisible({ timeout: 15_000 });
+ await expect(page.getByRole('button', { name: 'Share folder', exact: true })).toBeVisible();
+}
+
+async function expectAsset(page: Page, hash: string, assetName: string): Promise<void> {
+ await expectHash(page, hash);
+ await expect(page.getByRole('main', { name: assetName, exact: true })).toBeVisible({
+ timeout: 15_000,
+ });
+}
+
+async function expectSkillFile(
+ page: Page,
+ hash: string,
+ fileName: string,
+ marker: string,
+): Promise<void> {
+ await expectHash(page, hash);
+ const viewer = page.locator('[data-text-viewer][data-text-viewer-state="loaded"]');
+ await expect(viewer).toHaveAttribute('aria-label', fileName, { timeout: 15_000 });
+ await expect(viewer).toContainText(marker);
+}
+
+test('browser history traverses every user-facing navigation target and truncates forward branches', async ({
+ page,
+ api,
+ workerServer,
+}) => {
+ const id = randomUUID();
+ const baselineDoc = `nav-baseline-${id}`;
+ const secondDoc = `nav-second-${id}`;
+ const folder = `nav-folder-${id}`;
+ const assetName = `nav-asset-${id}.png`;
+ const assetPath = `${folder}/${assetName}`;
+ const indexDoc = `${folder}/index`;
+ const indexMarkdown = `# Navigation Index ${id}\n\n![Navigation asset](./${assetName})\n`;
+ const indexBumpDoc = `nav-index-bump-${id}`;
+ const skillName = `nav-skill-${id}`;
+ const bundleFile = `history-${id}.ts`;
+ const bundlePath = `scripts/${bundleFile}`;
+ const bundleMarker = `navigation-history-${id}`;
+
+ await api.seedDocs([
+ { name: baselineDoc, markdown: `# Navigation Baseline ${id}\n` },
+ { name: secondDoc, markdown: `# Navigation Second ${id}\n` },
+ { name: indexDoc, markdown: indexMarkdown },
+ ]);
+
+ writeFileSync(join(workerServer.contentDir, assetPath), createPngBuffer(assetPath));
+ writeFileSync(join(workerServer.contentDir, `${indexDoc}.md`), indexMarkdown, 'utf-8');
+
+ try {
+ await api.createPage(`${indexBumpDoc}.md`);
+ await expect
+ .poll(
+ async () => {
+ const response = await fetch(`${workerServer.baseURL}/api/documents`);
+ if (!response.ok) {
+ throw new Error(`GET /api/documents failed: ${response.status}`);
+ }
+ const body = (await response.json()) as {
+ documents?: Array<{ kind?: string; path?: string }>;
+ };
+ return body.documents?.some(
+ (entry) => entry.kind === 'asset' && entry.path === assetPath,
+ );
+ },
+ { timeout: 15_000 },
+ )
+ .toBe(true);
+
+ const skillResponse = await fetch(`${workerServer.baseURL}/api/skill`, {
+ method: 'PUT',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ scope: 'project',
+ name: skillName,
+ frontmatter: {
+ name: skillName,
+ description: 'Navigation history browser coverage',
+ },
+ body: `# Navigation Skill ${id}\n`,
+ }),
+ });
+ expect(skillResponse.status).toBe(200);
+ expect(await skillResponse.json()).toMatchObject({
+ created: true,
+ path: expect.stringContaining(skillName),
+ });
+
+ const skillFileResponse = await fetch(`${workerServer.baseURL}/api/skill-file`, {
+ method: 'PUT',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ scope: 'project',
+ name: skillName,
+ path: bundlePath,
+ content: `export const marker = '${bundleMarker}';\n`,
+ }),
+ });
+ expect(skillFileResponse.status).toBe(200);
+ expect(await skillFileResponse.json()).toMatchObject({
+ created: true,
+ kind: 'script',
+ content: false,
+ path: expect.stringContaining(bundlePath),
+ });
+
+ const baselineHash = `#/${baselineDoc}`;
+ const secondHash = `#/${secondDoc}`;
+ const folderHash = `#/${folder}/`;
+ const indexHash = `#/${indexDoc}`;
+ const assetHash = `#/__asset__/${assetPath}`;
+ const skillFileHash = `#/__skill-file__/project/${skillName}/${bundlePath}`;
+
+ await page.goto(`/${baselineHash}`);
+ await expectDocument(page, baselineHash, `Navigation Baseline ${id}`);
+
+ await sidebarTreeItem(page, `${secondDoc}.md`).click();
+ await expectDocument(page, secondHash, `Navigation Second ${id}`);
+
+ await sidebarTreeItem(page, folder).click();
+ await expectFolder(page, folderHash, folder);
+
+ await sidebarTreeItem(page, 'index.md').click();
+ await expectDocument(page, indexHash, `Navigation Index ${id}`);
+
+ await sidebarTreeItem(page, assetName).click();
+ await expectAsset(page, assetHash, assetName);
+
+ const sidebar = page.locator('[data-slot="sidebar-container"]');
+ await sidebar.getByRole('button', { name: 'Skills', exact: true }).click();
+ await sidebar.getByRole('button', { name: 'Project', exact: true }).click();
+ await sidebar.getByText(skillName, { exact: true }).click();
+ await sidebar.getByText('scripts/', { exact: true }).click();
+ await sidebar.getByTestId(`skill-file-${bundlePath}`).click();
+ await expectSkillFile(page, skillFileHash, bundleFile, bundleMarker);
+
+ await page.goBack();
+ await expectAsset(page, assetHash, assetName);
+ await page.goBack();
+ await expectDocument(page, indexHash, `Navigation Index ${id}`);
+ await page.goBack();
+ await expectFolder(page, folderHash, folder);
+ await page.goBack();
+ await expectDocument(page, secondHash, `Navigation Second ${id}`);
+ await page.goBack();
+ await expectDocument(page, baselineHash, `Navigation Baseline ${id}`);
+
+ await page.goForward();
+ await expectDocument(page, secondHash, `Navigation Second ${id}`);
+ await page.goForward();
+ await expectFolder(page, folderHash, folder);
+ await page.goForward();
+ await expectDocument(page, indexHash, `Navigation Index ${id}`);
+ await page.goForward();
+ await expectAsset(page, assetHash, assetName);
+ await page.goForward();
+ await expectSkillFile(page, skillFileHash, bundleFile, bundleMarker);
+
+ await page.goBack();
+ await expectAsset(page, assetHash, assetName);
+ await sidebarTreeItem(page, `${baselineDoc}.md`).click();
+ await expectDocument(page, baselineHash, `Navigation Baseline ${id}`);
+ await page.goForward();
+ await expectDocument(page, baselineHash, `Navigation Baseline ${id}`);
+ } finally {
+ rmSync(join(workerServer.contentDir, assetPath), { force: true });
+ }
+});
diff --git a/packages/app/tests/stress/sidebar-search-pill.e2e.ts b/packages/app/tests/stress/sidebar-search-pill.e2e.ts
index c7b58992e..839ce8697 100644
--- a/packages/app/tests/stress/sidebar-search-pill.e2e.ts
+++ b/packages/app/tests/stress/sidebar-search-pill.e2e.ts
@@ -15,7 +15,8 @@
* - divergent click-while-open semantics: pill click is a no-op when the
* palette is open (mirrors the legacy icon); ⌘K-while-open toggles
* closed (preserves the global-shortcut contract)
- * - removal of the legacy Search ToolbarButton from SidebarHeader
+ * - project actions live with the project-root row rather than
+ * SidebarHeader; the legacy Search ToolbarButton remains absent
* - accessible-name calculation returns "Search" with no aria-label
* override; lucide icon carries aria-hidden
* - compositional journey: discovery → click → query → result selection
@@ -29,9 +30,9 @@
* suppressed by the pill overrides
* - the pill follows the sidebar offcanvas during collapse
* - web-mode 'Files' label still renders alongside the pill
- * - empty-workspace path (hasFolders === false) renders the pill
- * alongside the 4-button toolbar — the Tree view options trigger is
- * state-independent (its Show group always has content)
+ * - empty-workspace path (hasFolders === false) renders the pill while the
+ * project-root action row retains all 4 controls — the Tree view options
+ * trigger is state-independent (its Show group always has content)
* - the multi-scope search backend still yields results when the pill
* opens the palette (no regression in palette functionality)
* - the locked `data-telemetry-event="ok.sidebar.search_pill.click"`
@@ -63,6 +64,11 @@ const pill = (page: Page) => page.locator('[data-telemetry-event="ok.sidebar.sea
const cmdkRoot = (page: Page) => page.locator('[cmdk-root]');
const cmdkInput = (page: Page) => page.locator('[data-slot="command-input"]');
const sidebarHeader = (page: Page) => page.locator('[data-slot="sidebar-header"]');
+const projectRootToolbar = (page: Page) =>
+ page
+ .locator('[data-sidebar-root-context]')
+ .locator('xpath=ancestor::*[@data-slot="sidebar-group"][1]')
+ .getByTestId('sidebar-toolbar');
async function deletePathIfExists(baseURL: string, kind: 'file' | 'folder', path: string) {
const response = await fetch(`${baseURL}/api/delete-path`, {
@@ -263,16 +269,15 @@ test.describe('sidebar-search-pill — discovery, click, keyboard, semantics', (
await expect(cmdkRoot(page)).toBeHidden({ timeout: 2_000 });
});
- test('legacy Search ToolbarButton is gone from SidebarHeader (no two redundant entry points)', async ({
+ test('project actions live under the project-root row and Search stays out of SidebarHeader', async ({
page,
api,
workerServer,
}) => {
- // Seed a doc inside a folder so hasFolders → true → all four toolbar
- // buttons render. The pill button ALSO has accessible name "Search"
- // — but lives OUTSIDE SidebarHeader, so we scope our query to the
- // header container. Seed a root-level template so the smart-hide gate
- // around "New from template" evaluates true (the button hides when
+ // Seed a doc inside a folder so hasFolders → true → all four project-root
+ // actions render. The pill button ALSO has accessible name "Search" but
+ // lives outside SidebarHeader. Seed a root-level template so the smart-hide
+ // gate around "New from template" evaluates true (the button hides when
// zero templates resolve at the root cascade).
await api.seedDocs([{ name: 'q006', markdown: '# q006\n\nBody.' }]);
const folderRes = await fetch(`${workerServer.baseURL}/api/create-folder`, {
@@ -305,11 +310,17 @@ test.describe('sidebar-search-pill — discovery, click, keyboard, semantics', (
timeout: 15_000,
});
- // No button with accessible name 'Search' exists inside SidebarHeader.
+ // SidebarHeader no longer owns the project action toolbar, and the legacy
+ // Search ToolbarButton remains absent.
+ await expect(sidebarHeader(page).getByTestId('sidebar-toolbar')).toHaveCount(0);
const searchInsideHeader = sidebarHeader(page).getByRole('button', { name: 'Search' });
await expect(searchInsideHeader).toHaveCount(0);
- // The four expected toolbar buttons are present. `'New from template'`
+ // The toolbar is nested under the project-root group, beside the root row.
+ const toolbar = projectRootToolbar(page);
+ await expect(toolbar).toBeVisible();
+
+ // The four expected project actions are present. `'New from template'`
// uniquely identifies the FilePlus button — no other toolbar button
// has that substring in its accessible name. Label is ASCII-only by
// codebase microcopy policy (U+2026 reserved for macOS native menus
@@ -319,14 +330,10 @@ test.describe('sidebar-search-pill — discovery, click, keyboard, semantics', (
// Chromium drops a trailing U+2026 from the computed accessible name
// while macOS preserves it — so the pattern is portable even if a
// future label gains a trailing ellipsis.
- await expect(
- sidebarHeader(page).getByRole('button', { name: 'Tree view options' }),
- ).toBeVisible();
- await expect(sidebarHeader(page).getByRole('button', { name: 'New file' })).toBeVisible();
- await expect(
- sidebarHeader(page).getByRole('button', { name: 'New from template' }),
- ).toBeVisible();
- await expect(sidebarHeader(page).getByRole('button', { name: 'New folder' })).toBeVisible();
+ await expect(toolbar.getByRole('button', { name: 'Tree view options' })).toBeVisible();
+ await expect(toolbar.getByRole('button', { name: 'New file' })).toBeVisible();
+ await expect(toolbar.getByRole('button', { name: 'New from template' })).toBeVisible();
+ await expect(toolbar.getByRole('button', { name: 'New folder' })).toBeVisible();
});
test('pill has accessible name "Search" with no aria-label override; lucide icon is aria-hidden', async ({
@@ -844,7 +851,7 @@ test.describe('sidebar-search-pill — Electron host & sidebar-state', () => {
.toBe('expanded');
});
- test('empty workspace — pill renders alongside the 4-button toolbar (Tree view options trigger is state-independent)', async ({
+ test('empty workspace — pill and the project-root 4-button toolbar remain available', async ({
page,
api,
workerServer,
@@ -858,8 +865,8 @@ test.describe('sidebar-search-pill — Electron host & sidebar-state', () => {
// Seed a root template so the smart-hide gate around "New from
// template" resolves true — that button hides when zero templates
- // resolve at the root cascade (see the "legacy Search ToolbarButton
- // is gone" test). Without an explicit seed this test passed only when
+ // resolve at the root cascade (see the project-actions placement test
+ // above). Without an explicit seed this test passed only when
// an earlier same-worker test happened to leave a template behind;
// seeding here makes the 3-button assertion deterministic.
const templateRes = await fetch(`${workerServer.baseURL}/api/template`, {
@@ -879,24 +886,20 @@ test.describe('sidebar-search-pill — Electron host & sidebar-state', () => {
await page.setViewportSize(DESKTOP_VIEWPORT);
await page.goto('/');
- // Four core toolbar buttons present. ASCII-only substring match for
- // `New from template` — see the comment in the "legacy Search
- // ToolbarButton is gone from SidebarHeader" test above for the
- // cross-platform accessible-name rationale.
- await expect(sidebarHeader(page).getByRole('button', { name: 'New file' })).toBeVisible({
- timeout: 15_000,
- });
- await expect(
- sidebarHeader(page).getByRole('button', { name: 'New from template' }),
- ).toBeVisible();
- await expect(sidebarHeader(page).getByRole('button', { name: 'New folder' })).toBeVisible();
+ const toolbar = projectRootToolbar(page);
+ await expect(toolbar).toBeVisible({ timeout: 15_000 });
+
+ // Four core project actions are present. ASCII-only substring match for
+ // `New from template` — see the project-actions placement test above
+ // for the cross-platform accessible-name rationale.
+ await expect(toolbar.getByRole('button', { name: 'New file' })).toBeVisible();
+ await expect(toolbar.getByRole('button', { name: 'New from template' })).toBeVisible();
+ await expect(toolbar.getByRole('button', { name: 'New folder' })).toBeVisible();
// Tree view options trigger stays VISIBLE with zero folders — its Show
// group is folder-state-independent, so the trigger no longer smart-
// hides with the Expand/Collapse-all commands.
- await expect(
- sidebarHeader(page).getByRole('button', { name: 'Tree view options' }),
- ).toBeVisible();
+ await expect(toolbar.getByRole('button', { name: 'Tree view options' })).toBeVisible();
// Pill renders normally.
await expect(pill(page)).toBeVisible();
diff --git a/packages/core/src/commands/command-identity.ts b/packages/core/src/commands/command-identity.ts
index 822f8dabc..efd61334d 100644
--- a/packages/core/src/commands/command-identity.ts
+++ b/packages/core/src/commands/command-identity.ts
@@ -126,6 +126,7 @@ export type MenuSection =
| 'view-panels'
| 'view-visibility'
| 'view-tree'
+ | 'view-history'
| 'terminal'
| 'help-install'
| 'help-links'
@@ -220,6 +221,35 @@ export interface CommandIdentity {
* Menu-only commands are interleaved near their menu neighbors.
*/
export const COMMAND_IDENTITIES: readonly CommandIdentity[] = [
+ // ── Commands group (palette) / View-history (menu) ─────────────────────────
+ {
+ id: 'navigate-back',
+ menuActionId: 'navigate-back',
+ labelKey: 'back',
+ keywords: ['previous history'],
+ shortcutId: 'navigate-back',
+ shortcutDesktopOnly: true,
+ availability: { host: 'desktop' },
+ palette: { group: 'commands', visibility: 'search-only' },
+ menu: [
+ { section: 'view-history', order: 0, platform: 'mac', accelerator: 'Cmd+[' },
+ { section: 'view-history', order: 0, platform: 'other', accelerator: 'Alt+Left' },
+ ],
+ },
+ {
+ id: 'navigate-forward',
+ menuActionId: 'navigate-forward',
+ labelKey: 'forward',
+ keywords: ['next history'],
+ shortcutId: 'navigate-forward',
+ shortcutDesktopOnly: true,
+ availability: { host: 'desktop' },
+ palette: { group: 'commands', visibility: 'search-only' },
+ menu: [
+ { section: 'view-history', order: 1, platform: 'mac', accelerator: 'Cmd+]' },
+ { section: 'view-history', order: 1, platform: 'other', accelerator: 'Alt+Right' },
+ ],
+ },
// ── Commands group (palette) / File-create (menu) ───────────────────────────
{
id: 'new-file',
diff --git a/packages/core/src/constants/menu-labels.ts b/packages/core/src/constants/menu-labels.ts
index 262404ab8..9e41e059f 100644
--- a/packages/core/src/constants/menu-labels.ts
+++ b/packages/core/src/constants/menu-labels.ts
@@ -90,6 +90,8 @@ export const MENU_LABELS = {
sidebarHide: 'Hide sidebar',
docPanelShow: 'Show document panel',
docPanelHide: 'Hide document panel',
+ back: 'Back',
+ forward: 'Forward',
terminalShow: 'Show Terminal',
terminalHide: 'Hide Terminal',
// Palette form for the install command, whose native-menu leaf renders a
diff --git a/packages/core/src/desktop-bridge.ts b/packages/core/src/desktop-bridge.ts
index 66d906b4a..cf93c0bd0 100644
--- a/packages/core/src/desktop-bridge.ts
+++ b/packages/core/src/desktop-bridge.ts
@@ -81,6 +81,9 @@ type OkMenuAction =
| 'version-history'
| 'focus-search'
| 'focus-command-palette'
+ // Navigation history.
+ | 'navigate-back'
+ | 'navigate-forward'
// File menu state-aware items. See bridge-contract.ts for
// rationale; mirrored here per the OkDesktopBridge 3-way-mirror invariant.
| 'new-from-template'
diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.ts
index a967e890c..04deb547a 100644
--- a/packages/desktop/src/main/index.ts
+++ b/packages/desktop/src/main/index.ts
@@ -2647,6 +2647,9 @@ async function runApplicationMenuRefresh(): Promise<void> {
getLogger('lifecycle').error({ err }, 'desktop self-uninstall flow failed');
})
: undefined,
+ // View menu history traversal uses the same focused-renderer action channel.
+ onNavigateBack: () => sendMenuActionToFocused('navigate-back'),
+ onNavigateForward: () => sendMenuActionToFocused('navigate-forward'),
// File menu state-aware items. activeTarget drives enable/disable;
// per-item handlers fire `ok:menu-action` to the focused renderer which
// already knows the current scope (sidebar selection + editor
diff --git a/packages/desktop/src/main/menu.ts b/packages/desktop/src/main/menu.ts
index 2db20bb9e..052fb6a12 100644
--- a/packages/desktop/src/main/menu.ts
+++ b/packages/desktop/src/main/menu.ts
@@ -6,7 +6,8 @@
* Recent project submenu, Close Window
* - Edit: macOS defaults (Undo/Redo/Cut/Copy/Paste/Select All)
* - View: Reload / Force Reload / zoom / fullscreen always; Toggle DevTools
- * gated on `showDevToolsMenu` (dev + beta only) — Electron built-in roles
+ * gated on `showDevToolsMenu` (dev + beta only) — Electron built-in roles;
+ * Back / Forward navigation history
* - Window: macOS defaults (Minimize / Zoom / Bring to Front)
*
* Deferred to later work:
@@ -49,6 +50,8 @@ import type { EditorActiveTargetSnapshot } from '../shared/ipc-channels.ts';
import { promptForExistingFolder, promptForExistingMarkdownFile } from './dialog-helpers.ts';
export interface MenuDeps {
+ onNavigateBack?(): void;
+ onNavigateForward?(): void;
/** `app.name` — the running app's name, used for the macOS App menu label. */
appName: string;
/**
@@ -383,6 +386,14 @@ interface MenuCommandBinding {
}
const MENU_BINDINGS: Record<string, MenuCommandBinding> = {
+ 'navigate-back': {
+ click: (d) => () => d.onNavigateBack?.(),
+ enabled: (d) => d.onNavigateBack !== undefined,
+ },
+ 'navigate-forward': {
+ click: (d) => () => d.onNavigateForward?.(),
+ enabled: (d) => d.onNavigateForward !== undefined,
+ },
'new-file': { click: (d) => () => d.onNewFile?.(), enabled: (d) => d.onNewFile !== undefined },
'new-folder': {
click: (d) => () => d.onNewFolder?.(),
@@ -799,6 +810,8 @@ export function buildMenuTemplate(deps: MenuDeps): MenuItemConstructorOptions[]
{
label: 'View',
submenu: [
+ ...leafOf('view-history'),
+ { type: 'separator' as const },
// Reload / Force Reload ship on every channel; Toggle Developer Tools is
// gated on `showDevToolsMenu` (dev + beta) — Electron built-in roles.
{ role: 'reload' as const },
diff --git a/packages/desktop/src/shared/bridge-contract.ts b/packages/desktop/src/shared/bridge-contract.ts
index 227a9b7b6..05af5e46c 100644
--- a/packages/desktop/src/shared/bridge-contract.ts
+++ b/packages/desktop/src/shared/bridge-contract.ts
@@ -205,6 +205,9 @@ export type OkMenuAction =
| 'version-history'
| 'focus-search'
| 'focus-command-palette'
+ // Navigation history.
+ | 'navigate-back'
+ | 'navigate-forward'
// File menu state-aware items. Renderer subscribes via the existing
// `onMenuAction` bridge surface; routing through the same channel
// avoids inventing a new IPC for what is conceptually "user picked a menu
diff --git a/packages/desktop/tests/integration/m1-smoke.test.ts b/packages/desktop/tests/integration/m1-smoke.test.ts
index d0be2c159..01f815296 100644
--- a/packages/desktop/tests/integration/m1-smoke.test.ts
+++ b/packages/desktop/tests/integration/m1-smoke.test.ts
@@ -598,12 +598,8 @@ describe('M1 smoke', () => {
expect(desktopMembers.size).toBeGreaterThan(0);
expect(coreMembers.size).toBeGreaterThan(0);
expect(appMembers.size).toBeGreaterThan(0);
- // 26 + 2 worktree actions (`new-worktree`, `switch-worktree`) for the
- // worktree selector (worktree = window) + `report-bug` and
- // `send-feedback` (Help menu) + 3 sidebar visibility toggles
- // (`toggle-show-ok-folders`, `toggle-show-only-markdown-files`,
- // `toggle-show-skills-section`).
- expect(desktopMembers.size).toBe(33);
+ // 26 baseline + 2 worktree + 2 Help + 3 sidebar + 2 navigation actions.
+ expect(desktopMembers.size).toBe(35);
expect(desktopMembers).toEqual(coreMembers);
expect(desktopMembers).toEqual(appMembers);
// Pin the visibility toggles explicitly: a bare count check wouldn't
@@ -615,6 +611,8 @@ describe('M1 smoke', () => {
expect(desktopMembers.has('new-worktree')).toBe(true);
expect(desktopMembers.has('switch-worktree')).toBe(true);
expect(desktopMembers.has('report-bug')).toBe(true);
+ expect(desktopMembers.has('navigate-back')).toBe(true);
+ expect(desktopMembers.has('navigate-forward')).toBe(true);
});
test('M1 invariant: EntryPoint / OkProjectEntryPoint literal-union drift catcher', async () => {
diff --git a/packages/desktop/tests/main/menu.test.ts b/packages/desktop/tests/main/menu.test.ts
index 1d6bf3fc3..13114c80b 100644
--- a/packages/desktop/tests/main/menu.test.ts
+++ b/packages/desktop/tests/main/menu.test.ts
@@ -49,6 +49,19 @@ function findByLabel(
return undefined;
}
+function buildMenuTemplateForPlatform(
+ platform: NodeJS.Platform,
+ deps: MenuDeps,
+): MenuItemConstructorOptions[] {
+ const original = process.platform;
+ Object.defineProperty(process, 'platform', { configurable: true, value: platform });
+ try {
+ return buildMenuTemplate(deps);
+ } finally {
+ Object.defineProperty(process, 'platform', { configurable: true, value: original });
+ }
+}
+
describe('buildMenuTemplate', () => {
test('empty recents → "No recent projects" disabled placeholder', () => {
const deps = makeDeps();
@@ -1440,3 +1453,51 @@ describe('Terminal menu — New Terminal Window', () => {
expect(wired?.enabled).toBe(true);
});
});
+
+describe('buildMenuTemplate — View navigation history', () => {
+ test('does not add a standalone Go menu', () => {
+ const labels = buildMenuTemplate(makeDeps()).map((item) => item.label);
+ expect(labels).not.toContain('Go');
+ });
+
+ test('starts View with Back before Forward and platform-specific accelerators', () => {
+ const callbacks = {
+ onNavigateBack: vi.fn(() => {}),
+ onNavigateForward: vi.fn(() => {}),
+ };
+
+ const mac = buildMenuTemplateForPlatform('darwin', makeDeps(callbacks));
+ const macRows = findByLabel(mac, 'View')?.submenu as MenuItemConstructorOptions[] | undefined;
+ expect(macRows?.slice(0, 2).map((item) => item.label)).toEqual(['Back', 'Forward']);
+ expect(findByLabel(mac, 'Back')?.accelerator).toBe('Cmd+[');
+ expect(findByLabel(mac, 'Forward')?.accelerator).toBe('Cmd+]');
+
+ const windows = buildMenuTemplateForPlatform('win32', makeDeps(callbacks));
+ const windowsRows = findByLabel(windows, 'View')?.submenu as
+ | MenuItemConstructorOptions[]
+ | undefined;
+ expect(windowsRows?.slice(0, 2).map((item) => item.label)).toEqual(['Back', 'Forward']);
+ expect(findByLabel(windows, 'Back')?.accelerator).toBe('Alt+Left');
+ expect(findByLabel(windows, 'Forward')?.accelerator).toBe('Alt+Right');
+ });
+
+ test('invokes each callback exactly once', () => {
+ const onNavigateBack = vi.fn(() => {});
+ const onNavigateForward = vi.fn(() => {});
+ const template = buildMenuTemplate(makeDeps({ onNavigateBack, onNavigateForward }));
+
+ (findByLabel(template, 'Back')?.click as (() => void) | undefined)?.();
+ expect(onNavigateBack).toHaveBeenCalledOnce();
+ expect(onNavigateForward).not.toHaveBeenCalled();
+
+ (findByLabel(template, 'Forward')?.click as (() => void) | undefined)?.();
+ expect(onNavigateBack).toHaveBeenCalledOnce();
+ expect(onNavigateForward).toHaveBeenCalledOnce();
+ });
+
+ test('disables both rows when their callbacks are unwired', () => {
+ const template = buildMenuTemplate(makeDeps());
+ expect(findByLabel(template, 'Back')?.enabled).toBe(false);
+ expect(findByLabel(template, 'Forward')?.enabled).toBe(false);
+ });
+});
diff --git a/packages/desktop/tests/smoke/sidebar-pill-lockstep-fade.e2e.ts b/packages/desktop/tests/smoke/sidebar-pill-lockstep-fade.e2e.ts
index 721e5ea6e..44f2a8843 100644
--- a/packages/desktop/tests/smoke/sidebar-pill-lockstep-fade.e2e.ts
+++ b/packages/desktop/tests/smoke/sidebar-pill-lockstep-fade.e2e.ts
@@ -2,9 +2,12 @@
* Sidebar search pill Electron-mode lockstep-fade smoke.
*
* Drives the real Electron binary via Playwright's `_electron` API and
- * verifies the Electron-only opacity gate on FileSidebar's chrome row:
+ * verifies navigation-control placement and the Electron-only opacity gate:
*
- * - The h-12 toolbar row carries `opacity-0` when the sidebar is
+ * - Expanded mode renders exactly one Back/Forward pair in SidebarHeader.
+ * - Collapsed mode moves that pair to EditorHeader without duplication.
+ * - Both placements traverse the real browser-history stack.
+ * - The h-12 sidebar chrome row carries `opacity-0` when the sidebar is
* collapsed (`shouldFadeChrome && 'opacity-0'`).
* - The new sidebar-search-pill row, sibling between SidebarHeader and
* SidebarContent, also carries `opacity-0` under the same condition.
@@ -24,7 +27,7 @@
* Skip conditions match the existing desktop smoke pattern:
* - `OK_DESKTOP_E2E_SMOKE !== '1'` — opt-in gate.
* - `process.platform !== 'darwin'` — driver uses macOS `open(1)`.
- * - `out/main/index.js` missing — needs a prior `bun run build:desktop`.
+ * - `out/main/index.js` missing — needs a prior `pnpm build:desktop`.
*/
import { execSync } from 'node:child_process';
@@ -47,18 +50,34 @@ function userDataDirFor(home: string): string {
return join(home, 'electron-userdata');
}
+async function expectDocument(
+ page: import('@playwright/test').Page,
+ docName: string,
+ marker: string,
+): Promise<void> {
+ await expect
+ .poll(async () => decodeURIComponent(await page.evaluate(() => window.location.hash)))
+ .toBe(`#/${docName}`);
+ await expect(
+ page.locator('.ProseMirror:not(.composer-prosemirror)', { hasText: marker }),
+ ).toBeVisible({ timeout: 15_000 });
+}
+
test.describe('sidebar search pill — Electron lockstep-fade smoke', () => {
test.skip(!SMOKE_ENABLED, 'Set OK_DESKTOP_E2E_SMOKE=1 to run Electron smoke tests.');
test.skip(!DARWIN, 'Driver uses macOS open(1) and chrome stack is darwin-only in v0.');
- test.skip(
- !BUILD_EXISTS,
- `Main build missing at ${MAIN_ENTRY} — run "bun run build:desktop" first.`,
- );
+ test.skip(!BUILD_EXISTS, `Main build missing at ${MAIN_ENTRY} — run "pnpm build:desktop" first.`);
- test('expanded → neither row opacity-0; collapsed → BOTH rows opacity-0 (lockstep)', async ({
+ test('navigation controls relocate on collapse while sidebar chrome fades in lockstep', async ({
captureStderrFor,
}) => {
+ // Cold launch, deep-link window creation, and both expanded/collapsed
+ // history passes total ~167s of inner timeout budget.
+ test.setTimeout(180_000);
const docName = `sidebar-pill-${randomUUID()}`;
+ const secondDocName = `sidebar-pill-second-${randomUUID()}`;
+ const firstMarker = 'Sidebar Pill Lockstep Fade Smoke';
+ const secondMarker = 'Sidebar Pill Navigation Second';
const projectDir = mkdtempSync(join(tmpdir(), 'ok-sidebar-pill-'));
mkdirSync(join(projectDir, '.ok'), { recursive: true });
writeFileSync(
@@ -67,7 +86,11 @@ test.describe('sidebar search pill — Electron lockstep-fade smoke', () => {
);
writeFileSync(
join(projectDir, `${docName}.md`),
- '# Sidebar Pill Lockstep Fade Smoke\n\nFixture for chrome-row collapse verification.\n',
+ `# ${firstMarker}\n\nFixture for chrome-row collapse verification.\n`,
+ );
+ writeFileSync(
+ join(projectDir, `${secondDocName}.md`),
+ `# ${secondMarker}\n\nFixture for browser-history traversal.\n`,
);
const app = await electron.launch({
@@ -109,22 +132,43 @@ test.describe('sidebar search pill — Electron lockstep-fade smoke', () => {
() => typeof window !== 'undefined' && window.okDesktop != null,
);
expect(isElectronHost).toBe(true);
+ await expectDocument(page, docName, firstMarker);
// Wait for the sidebar to render in expanded state — pill must be
// present + visible in the DOM before the collapse toggle works.
const pill = page.getByRole('button', { name: /^Search/ });
await pill.waitFor({ state: 'visible', timeout: 10_000 });
- // The toolbar row is the inner div that holds the ToolbarButtons,
- // and the pill row is its sibling div between SidebarHeader and
- // SidebarContent. Locate both via stable structural selectors.
- //
- // Toolbar row: an `[data-slot="sidebar-header"]` is the parent;
- // the toolbar inner div is its direct child carrying the
- // `[&>*]:[-webkit-app-region:no-drag]` class fragment in Electron
- // mode. We read the SidebarHeader itself — the opacity gate is on
- // the header element's own className, applied via the
- // `shouldFadeChrome && 'opacity-0'` line in FileSidebar.tsx.
+ const sidebarHeader = page.locator('[data-slot="sidebar-header"]');
+ const editorHeader = page.locator('[data-slot="sidebar-inset"] > header');
+ const backButtons = page.getByRole('button', { name: 'Back', exact: true });
+ const forwardButtons = page.getByRole('button', { name: 'Forward', exact: true });
+ const sidebarBack = sidebarHeader.getByRole('button', { name: 'Back', exact: true });
+ const sidebarForward = sidebarHeader.getByRole('button', { name: 'Forward', exact: true });
+ const headerBack = editorHeader.getByRole('button', { name: 'Back', exact: true });
+ const headerForward = editorHeader.getByRole('button', { name: 'Forward', exact: true });
+
+ // Expanded placement: SidebarHeader owns the only Back/Forward pair.
+ await expect(sidebarBack).toHaveCount(1);
+ await expect(sidebarForward).toHaveCount(1);
+ await expect(headerBack).toHaveCount(0);
+ await expect(headerForward).toHaveCount(0);
+ await expect(backButtons).toHaveCount(1);
+ await expect(forwardButtons).toHaveCount(1);
+
+ // Build a real two-document history stack through the file tree, then
+ // traverse it with the expanded SidebarHeader controls.
+ await page
+ .locator('[data-slot="sidebar-container"]')
+ .getByRole('treeitem', { name: `${secondDocName}.md`, exact: true })
+ .click();
+ await expectDocument(page, secondDocName, secondMarker);
+ await sidebarBack.click();
+ await expectDocument(page, docName, firstMarker);
+ await sidebarForward.click();
+ await expectDocument(page, secondDocName, secondMarker);
+
+ // SidebarHeader and the pill row are the two fade-gated chrome surfaces.
const collectFadeState = async () => {
return page.evaluate(() => {
const header = document.querySelector('[data-slot="sidebar-header"]') as HTMLElement | null;
@@ -218,5 +262,20 @@ test.describe('sidebar search pill — Electron lockstep-fade smoke', () => {
expect(collapsed.pillRowHasOpacity0).toBe(true);
expect(collapsed.headerHasTransition).toBe(true);
expect(collapsed.pillRowHasTransition).toBe(true);
+
+ // Collapsed placement: the off-canvas SidebarHeader pair unmounts and the
+ // EditorHeader pair becomes the only history control surface.
+ await expect(sidebarBack).toHaveCount(0);
+ await expect(sidebarForward).toHaveCount(0);
+ await expect(headerBack).toHaveCount(1);
+ await expect(headerForward).toHaveCount(1);
+ await expect(backButtons).toHaveCount(1);
+ await expect(forwardButtons).toHaveCount(1);
+
+ // The relocated pair drives the same browser history.
+ await headerBack.click();
+ await expectDocument(page, docName, firstMarker);
+ await headerForward.click();
+ await expectDocument(page, secondDocName, secondMarker);
});
});