Skip to content

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

fix: return focus to the overflow trigger after a navigating menu item (#5653)

Adam Eivy2bffdcce555f
diff --git a/client/src/components/ui/OverflowMenu.jsx b/client/src/components/ui/OverflowMenu.jsx
index 3e877f4b37..c1a48e9cf3 100644
--- a/client/src/components/ui/OverflowMenu.jsx
+++ b/client/src/components/ui/OverflowMenu.jsx
@@ -137,11 +137,13 @@ export default function OverflowMenu({ label, items = [], className = '', trigge
<span>{item.label}</span>
</>
);
- // A navigating item is an anchor, not a button — the route change
- // moves focus on its own, so don't hand it back to the trigger.
+ // A navigating item is an anchor, not a button. Hand focus back to
+ // the trigger the same way an action item does: the anchor unmounts
+ // with the menu, so without this a keyboard activation would strand
+ // focus on <body> whenever the route renders in place.
if (item.to) {
return (
- <Link key={item.id} to={item.to} role="menuitem" className={itemClass} onClick={() => close(false)}>
+ <Link key={item.id} to={item.to} role="menuitem" className={itemClass} onClick={() => close(true)}>
{content}
</Link>
);
diff --git a/client/src/components/ui/OverflowMenu.test.jsx b/client/src/components/ui/OverflowMenu.test.jsx
index f86b1f59f9..8b9fdff9e7 100644
--- a/client/src/components/ui/OverflowMenu.test.jsx
+++ b/client/src/components/ui/OverflowMenu.test.jsx
@@ -163,7 +163,11 @@ describe('OverflowMenu', () => {
expect(item.tagName).toBe('A');
expect(item).toHaveAttribute('href', '/models/performance');
+ const trigger = screen.getByRole('button', { name: 'More actions' });
await user.click(item);
expect(screen.queryByRole('menu')).toBeNull();
+ // The activated anchor unmounts with the menu, so focus has to be handed
+ // back or a keyboard user is stranded on <body>.
+ expect(document.activeElement).toBe(trigger);
});
});