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: return focus to the row's '…' trigger when a delete confirmation is dismissed (#3286)
[._.]/ Adam Eivy2797ae618eb0
diff --git a/client/src/components/ui/OverflowMenu.jsx b/client/src/components/ui/OverflowMenu.jsxindex 0d52dad02a..39d375ab72 100644--- a/client/src/components/ui/OverflowMenu.jsx+++ b/client/src/components/ui/OverflowMenu.jsx@@ -18,11 +18,14 @@ const TONES = {const ITEM_SELECTOR = '[role="menuitem"]:not(:disabled)';-export default function OverflowMenu({ label, items = [], className = '' }) {+export default function OverflowMenu({ label, items = [], className = '', triggerRef: externalTriggerRef }) {const [open, setOpen] = useState(false);const wrapperRef = useRef(null);- const triggerRef = useRef(null);+ const internalTriggerRef = useRef(null);const menuRef = useRef(null);+ // Callers that dismiss follow-up UI opened from an item (an inline confirm)+ // pass `triggerRef` so they can hand focus back to the trigger it came from.+ const triggerRef = externalTriggerRef || internalTriggerRef;const close = useCallback((refocus) => {setOpen(false);diff --git a/client/src/components/ui/OverflowMenu.test.jsx b/client/src/components/ui/OverflowMenu.test.jsxindex 18c3b78e78..67ec3f9ccf 100644--- a/client/src/components/ui/OverflowMenu.test.jsx+++ b/client/src/components/ui/OverflowMenu.test.jsx@@ -1,3 +1,4 @@+import { useRef } from 'react';import { describe, it, expect, vi } from 'vitest';import { render, screen } from '@testing-library/react';import userEvent from '@testing-library/user-event';@@ -76,6 +77,23 @@ describe('OverflowMenu', () => {expect(list[0].onSelect).not.toHaveBeenCalled();});+ it('exposes the trigger through an external triggerRef so callers can return focus to it', async () => {+ const user = userEvent.setup();+ const Harness = () => {+ const triggerRef = useRef(null);+ return (+ <div>+ <button type="button" onClick={() => triggerRef.current?.focus()}>refocus</button>+ <OverflowMenu label="More actions" items={items()} triggerRef={triggerRef} />+ </div>+ );+ };+ render(<Harness />);++ await user.click(screen.getByRole('button', { name: 'refocus' }));+ expect(document.activeElement).toBe(screen.getByRole('button', { name: 'More actions' }));+ });+it('closes on an outside click', async () => {const user = userEvent.setup();render(diff --git a/client/src/pages/Apps.jsx b/client/src/pages/Apps.jsxindex 3a61ab9413..536b95cb51 100644--- a/client/src/pages/Apps.jsx+++ b/client/src/pages/Apps.jsx@@ -1,4 +1,4 @@-import { useState, useEffect, useCallback } from 'react';+import { useState, useEffect, useCallback, useRef } from 'react';import { Link } from 'react-router-dom';import { ExternalLink, Gamepad2, Play, Square, RotateCcw, FolderOpen, Terminal, Code, RefreshCw, Wrench, Archive, ArchiveRestore, Ticket, Download, Hammer, Smartphone, Trash2 } from 'lucide-react';import toast from '../components/ui/Toast';@@ -29,6 +29,10 @@ export default function Apps() {const [showArchived, setShowArchived] = useState(false);const [jiraTickets, setJiraTickets] = useState({});const [loadingTickets, setLoadingTickets] = useState({});+ // Per-row "…" trigger refs, so dismissing a row's delete confirmation hands+ // focus back to the control that opened it instead of dropping it on <body>.+ const menuTriggerRefs = useRef({});+ const menuTriggerRef = (id) => (menuTriggerRefs.current[id] ||= { current: null });const fetchApps = useCallback(async () => {const data = await api.getApps().catch(() => []);@@ -389,6 +393,7 @@ export default function Apps() {{app.id !== api.PORTOS_APP_ID && (<OverflowMenulabel={`More actions for ${app.name}`}+ triggerRef={menuTriggerRef(app.id)}items={[{id: 'archive',@@ -420,7 +425,10 @@ export default function Apps() {cancelText="Cancel"aria-label={`Confirm deletion of ${app.name}`}onConfirm={() => handleDelete(app)}- onCancel={() => setConfirmingDelete(null)}+ onCancel={() => {+ setConfirmingDelete(null);+ menuTriggerRef(app.id).current?.focus();+ }}/>)}</div>diff --git a/client/src/pages/Apps.test.jsx b/client/src/pages/Apps.test.jsxindex 153d48352a..5fcfe96c76 100644--- a/client/src/pages/Apps.test.jsx+++ b/client/src/pages/Apps.test.jsx@@ -101,6 +101,8 @@ describe('Apps row action hierarchy', () => {await user.click(screen.getByRole('button', { name: 'Cancel' }));expect(api.deleteApp).not.toHaveBeenCalled();expect(screen.queryByLabelText('Confirm deletion of Example App')).toBeNull();+ // Dismissing hands focus back to the trigger it came from, not to <body>.+ expect(document.activeElement).toBe(screen.getByRole('button', { name: 'More actions for Example App' }));});it('deletes only after the inline confirm is accepted', async () => {