From 34e30392ac2aa3a5622fbb814e266a8fcdcc8b9f Mon Sep 17 00:00:00 2001 From: qdzsh Date: Sun, 21 Jun 2026 20:59:01 +0700 Subject: [PATCH 1/4] fix(ui): stabilize account layout and API key dialog --- frontend/src/components/ui/dialog.tsx | 32 +++++++++ .../accounts/components/account-actions.tsx | 9 +-- .../accounts/components/account-detail.tsx | 4 +- .../accounts/components/account-list-item.tsx | 12 ++-- .../accounts/components/account-list.tsx | 13 ++-- .../components/account-proxy-binding.tsx | 9 +-- .../components/account-token-info.tsx | 12 ++-- .../components/account-usage-panel.tsx | 10 +-- .../components/accounts-page.test.tsx | 43 +++++++++++ .../accounts/components/accounts-page.tsx | 10 ++- .../accounts/components/accounts-skeleton.tsx | 8 +-- .../components/api-key-edit-dialog.test.tsx | 52 ++++++++++++++ .../proposal.md | 25 +++++++ .../specs/frontend-architecture/spec.md | 72 +++++++++++++++++++ .../tasks.md | 15 ++++ 15 files changed, 288 insertions(+), 38 deletions(-) create mode 100644 openspec/changes/fix-dashboard-responsive-select-dismissal/proposal.md create mode 100644 openspec/changes/fix-dashboard-responsive-select-dismissal/specs/frontend-architecture/spec.md create mode 100644 openspec/changes/fix-dashboard-responsive-select-dismissal/tasks.md diff --git a/frontend/src/components/ui/dialog.tsx b/frontend/src/components/ui/dialog.tsx index c9cc95bd1..b29b08810 100644 --- a/frontend/src/components/ui/dialog.tsx +++ b/frontend/src/components/ui/dialog.tsx @@ -47,10 +47,24 @@ function DialogOverlay({ ) } +const FLOATING_LAYER_SELECTOR = [ + "[data-slot='select-content']", + "[data-slot='dropdown-menu-content']", + "[data-slot='dropdown-menu-sub-content']", + "[data-slot='popover-content']", +].join(", ") + +function isFloatingLayerTarget(target: EventTarget | null): boolean { + return target instanceof Element && target.closest(FLOATING_LAYER_SELECTOR) !== null +} + function DialogContent({ className, children, showCloseButton = true, + onFocusOutside, + onInteractOutside, + onPointerDownOutside, ...props }: React.ComponentProps & { showCloseButton?: boolean @@ -64,6 +78,24 @@ function DialogContent({ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-hidden rounded-lg border p-6 shadow-lg duration-200 outline-none overscroll-contain sm:max-w-lg", className )} + onFocusOutside={(event) => { + onFocusOutside?.(event) + if (!event.defaultPrevented && isFloatingLayerTarget(event.target)) { + event.preventDefault() + } + }} + onInteractOutside={(event) => { + onInteractOutside?.(event) + if (!event.defaultPrevented && isFloatingLayerTarget(event.target)) { + event.preventDefault() + } + }} + onPointerDownOutside={(event) => { + onPointerDownOutside?.(event) + if (!event.defaultPrevented && isFloatingLayerTarget(event.target)) { + event.preventDefault() + } + }} {...props} > {children} diff --git a/frontend/src/features/accounts/components/account-actions.tsx b/frontend/src/features/accounts/components/account-actions.tsx index 6092b0ea8..866f433f3 100644 --- a/frontend/src/features/accounts/components/account-actions.tsx +++ b/frontend/src/features/accounts/components/account-actions.tsx @@ -64,8 +64,8 @@ export function AccountActions({ return (
{!showOperatorRecoveryAction ? ( -
-
+
+
Routing policy
@@ -82,7 +82,7 @@ export function AccountActions({ @@ -97,7 +97,7 @@ export function AccountActions({