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: dismiss combobox results before their parent picker
Adam Eivya99a6add9202
diff --git a/client/src/components/threads/AddToThreadButton.test.jsx b/client/src/components/threads/AddToThreadButton.test.jsxindex 43af1c2aa7..dac4b90ae1 100644--- a/client/src/components/threads/AddToThreadButton.test.jsx+++ b/client/src/components/threads/AddToThreadButton.test.jsx@@ -70,7 +70,7 @@ describe('AddToThreadButton', () => {});});- it('focuses the search input, traps Tab, and returns focus after Escape', async () => {+ it('traps focus and dismisses the suggestion list before the parent picker on Escape', async () => {render(<AddToThreadButton threadRef={sampleRef} />);const trigger = screen.getByRole('button', { name: 'Add to Brain thread' });trigger.focus();@@ -84,6 +84,14 @@ describe('AddToThreadButton', () => {fireEvent.keyDown(close, { key: 'Tab', shiftKey: true });expect(input).toHaveFocus();+ fireEvent.change(input, { target: { value: 'Sprint' } });+ expect(input).toHaveAttribute('aria-expanded', 'true');+ fireEvent.keyDown(input, { key: 'Escape' });+ expect(screen.getByRole('dialog', { name: 'Add to Brain thread' })).toBeInTheDocument();+ expect(input).toHaveAttribute('aria-expanded', 'false');+ expect(input).toHaveValue('Sprint');+ expect(input).toHaveFocus();+fireEvent.keyDown(input, { key: 'Escape' });await waitFor(() => {expect(screen.queryByRole('dialog')).not.toBeInTheDocument();diff --git a/client/src/hooks/useEscapeKey.js b/client/src/hooks/useEscapeKey.jsindex efcf5fe115..767467aa97 100644--- a/client/src/hooks/useEscapeKey.js+++ b/client/src/hooks/useEscapeKey.js@@ -4,7 +4,8 @@ import { useEffect, useRef } from 'react';* Call `handler` when Escape is pressed, but only while `active` is truthy.* Listener is attached/removed with `active`, so a closed popover/card doesn't* keep a global keydown handler around. Use for non-modal dismissables (the- * Modal component already owns Esc for true modals).+ * Modal component already owns Esc for true modals). A child control can+ * consume Escape with preventDefault() to dismiss its own layer first.** `handler` is read through a ref, so an inline arrow recreated every parent* render (the common call-site shape) doesn't tear down + re-add the global@@ -15,7 +16,7 @@ export default function useEscapeKey(active, handler) {handlerRef.current = handler;useEffect(() => {if (!active) return undefined;- const onKey = (e) => { if (e.key === 'Escape') handlerRef.current(); };+ const onKey = (e) => { if (e.key === 'Escape' && !e.defaultPrevented) handlerRef.current(); };window.addEventListener('keydown', onKey);return () => window.removeEventListener('keydown', onKey);}, [active]);