Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: harden command palette capture keyboard flow (#5427)
[._.]/ Adam Eivy740a2303292e
diff --git a/client/src/components/CmdKSearch.jsx b/client/src/components/CmdKSearch.jsxindex a4666f40bd..21c09abb79 100644--- a/client/src/components/CmdKSearch.jsx+++ b/client/src/components/CmdKSearch.jsx@@ -280,7 +280,7 @@ export default function CmdKSearch() {}, [focusedIndex]);useEffect(() => {- if (open && captureMode) inputRef.current?.focus();+ if (open) inputRef.current?.focus();}, [open, captureMode]);const resetCapture = useCallback(() => {@@ -375,10 +375,12 @@ export default function CmdKSearch() {const handleKeyDown = (e) => {if (captureMode) {if (e.key === 'Enter') {+ if (e.nativeEvent.isComposing || e.keyCode === 229) return;e.preventDefault();submitCapture();} else if (e.key === 'Escape') {e.preventDefault();+ e.stopPropagation();setCaptureMode(false);}return;diff --git a/client/src/components/CmdKSearch.test.jsx b/client/src/components/CmdKSearch.test.jsxindex 5d370e03af..dc3b792b76 100644--- a/client/src/components/CmdKSearch.test.jsx+++ b/client/src/components/CmdKSearch.test.jsx@@ -102,6 +102,18 @@ describe('CmdKSearch inline Brain capture', () => {expect(toast).not.toHaveBeenCalled();});+ it('does not submit while Enter is committing an IME composition', async () => {+ await renderBrainCapturePalette();+ fireEvent.click(await screen.findByRole('option', { name: /Capture to Brain/ }));+ const input = screen.getByRole('textbox', { name: 'Capture to Brain' });+ fireEvent.change(input, { target: { value: '候補' } });++ fireEvent.keyDown(input, { key: 'Enter', isComposing: true, keyCode: 229 });++ expect(runPaletteAction).not.toHaveBeenCalled();+ expect(input).toHaveValue('候補');+ });+it('enters capture mode from the keyboard', async () => {await renderBrainCapturePalette();const input = screen.getByRole('textbox', { name: 'Command palette' });@@ -174,12 +186,17 @@ describe('CmdKSearch inline Brain capture', () => {fireEvent.keyDown(searchInput, { key: 'Enter' });const captureInput = screen.getByRole('textbox', { name: 'Capture to Brain' });fireEvent.change(captureInput, { target: { value: 'Draft thought' } });+ const leakedEscape = vi.fn();+ window.addEventListener('keydown', leakedEscape);fireEvent.keyDown(captureInput, { key: 'Escape' });+ window.removeEventListener('keydown', leakedEscape);expect(screen.getByRole('dialog', { name: 'Command palette' })).toBeInTheDocument();const restoredSearch = screen.getByRole('textbox', { name: 'Command palette' });expect(restoredSearch).toHaveValue('capture');+ expect(restoredSearch).toHaveFocus();+ expect(leakedEscape).not.toHaveBeenCalled();fireEvent.keyDown(restoredSearch, { key: 'Escape' });await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());