From b53c02b2f249afdfdc17b014aa06c6e1a5db92ba Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 7 Aug 2026 14:32:14 -0700 Subject: [PATCH] fix(ui): preserve slow build-link navigation (#120334) * fix(ui): preserve slow build-link navigation * test(ui): stabilize slow build-link e2e --- ui/src/components/app-sidebar-agent-menu.ts | 13 +++++++++-- ui/src/e2e/build-info-unicode.e2e.test.ts | 26 +++++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ui/src/components/app-sidebar-agent-menu.ts b/ui/src/components/app-sidebar-agent-menu.ts index 41438c878f2a..9f74b0799237 100644 --- a/ui/src/components/app-sidebar-agent-menu.ts +++ b/ui/src/components/app-sidebar-agent-menu.ts @@ -48,6 +48,15 @@ const AGENT_VALUE_PREFIX = "agent:"; const COMMAND_VALUE_PREFIX = "command:"; const LINK_VALUE_PREFIX = "link:"; +// Nested overlays bubble lifecycle events through the dropdown. Only the +// owner's completed hide may remove its menu or consume its Escape state. +function closeMenuAfterOwnDropdownHide(event: Event, onClose: (restoreFocus?: boolean) => void) { + if (event.target !== event.currentTarget) { + return; + } + onClose(consumeDropdownKeyboardDismissal(event)); +} + type AgentMenuAgent = { id: string; name?: string; @@ -285,7 +294,7 @@ export function renderSidebarAgentMenu(params: SidebarAgentMenuParams) { }} @keydown=${(event: KeyboardEvent) => trackDropdownKeyboardDismissal(event, params.onTabAway)} - @wa-after-hide=${(event: Event) => params.onClose(consumeDropdownKeyboardDismissal(event))} + @wa-after-hide=${(event: Event) => closeMenuAfterOwnDropdownHide(event, params.onClose)} >