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
address review (codex): only activate clickableProps container on its own key events
[._.]/ Adam Eivyfe311af303f2
diff --git a/client/src/lib/a11yKeyboard.js b/client/src/lib/a11yKeyboard.jsindex ade7751bd7..00eb18488e 100644--- a/client/src/lib/a11yKeyboard.js+++ b/client/src/lib/a11yKeyboard.js@@ -35,6 +35,19 @@export function onActivateKeyDown(handler) {if (typeof handler !== 'function') return undefined;return (event) => {+ // Only activate when the key event ORIGINATED on the element this handler+ // is attached to — not when it bubbled up from a focusable descendant.+ // A clickable container often wraps its own action buttons (a row with a+ // Delete/Stop/Remove button, an expandable card with a caret toggle);+ // without this guard, pressing Enter/Space while focused on the inner+ // button would bubble here, fire the container's handler, AND+ // `preventDefault` the button's native activation — so "Delete" would+ // select the row instead of deleting. Only focusable descendants can be a+ // distinct key-event target (a non-focusable <span>/<div> never receives+ // the keydown), so this precisely excludes the controls we must not hijack.+ // `currentTarget` is only null outside a live dispatch (synthetic test+ // events) — there the guard is a no-op and activation proceeds.+ if (event.currentTarget != null && event.target !== event.currentTarget) return;// `' '` is the modern key value; `'Spacebar'` covers legacy engines.if (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar') {event.preventDefault();diff --git a/client/src/lib/a11yKeyboard.test.js b/client/src/lib/a11yKeyboard.test.jsindex f3911af9d5..e95f722e6c 100644--- a/client/src/lib/a11yKeyboard.test.js+++ b/client/src/lib/a11yKeyboard.test.js@@ -40,6 +40,27 @@ describe('onActivateKeyDown', () => {onActivateKeyDown(handler)(event);expect(handler).toHaveBeenCalledWith(event);});++ it('activates when the event originated on the element itself (target === currentTarget)', () => {+ const handler = vi.fn();+ const el = {};+ const preventDefault = vi.fn();+ onActivateKeyDown(handler)({ key: 'Enter', target: el, currentTarget: el, preventDefault });+ expect(handler).toHaveBeenCalledTimes(1);+ expect(preventDefault).toHaveBeenCalledTimes(1);+ });++ it('ignores a key event that bubbled up from a focusable descendant (target !== currentTarget)', () => {+ const handler = vi.fn();+ const container = {};+ const innerButton = {};+ const preventDefault = vi.fn();+ // Enter on an inner <button> bubbles to the container's handler — it must+ // NOT fire the container action nor preventDefault the button's activation.+ onActivateKeyDown(handler)({ key: 'Enter', target: innerButton, currentTarget: container, preventDefault });+ expect(handler).not.toHaveBeenCalled();+ expect(preventDefault).not.toHaveBeenCalled();+ });});describe('clickableProps', () => {diff --git a/client/src/pages/Browser.jsx b/client/src/pages/Browser.jsxindex 0e7e4a14e2..ecdd6e4b76 100644--- a/client/src/pages/Browser.jsx+++ b/client/src/pages/Browser.jsx@@ -296,7 +296,7 @@ export default function BrowserPage() {<h3 className="text-sm font-semibold text-white">Recent Logs</h3><buttononClick={fetchLogs}- aria-label="Reload page"+ aria-label="Refresh logs"className="text-xs text-gray-400 hover:text-white transition-colors"><RefreshCw size={14} />diff --git a/client/src/pages/PromptManager.jsx b/client/src/pages/PromptManager.jsxindex 9aaf434ead..2b2bb733be 100644--- a/client/src/pages/PromptManager.jsx+++ b/client/src/pages/PromptManager.jsx@@ -561,7 +561,7 @@ export default function PromptManager() {<h3 className="text-sm font-medium text-gray-400">Variables</h3><buttononClick={newVariable}- aria-label="Add prompt"+ aria-label="Add variable"className="p-1 text-port-accent hover:text-port-accent/80"><Plus size={16} />@@ -586,7 +586,7 @@ export default function PromptManager() {</button><buttononClick={() => deleteVariable(key)}- aria-label="Delete prompt"+ aria-label="Delete variable"className="p-1 text-gray-500 hover:text-port-error"><Trash2 size={14} />