Skip to content

fix(ui): stabilize account layout and API key dialog#1062

Open
qdzsh wants to merge 4 commits into
Soju06:mainfrom
qdzsh:fix/dashboard-responsive-select-dismissal
Open

fix(ui): stabilize account layout and API key dialog#1062
qdzsh wants to merge 4 commits into
Soju06:mainfrom
qdzsh:fix/dashboard-responsive-select-dismissal

Conversation

@qdzsh

@qdzsh qdzsh commented Jun 21, 2026

Copy link
Copy Markdown

Summary

Fixes the Accounts page responsive layout and keeps the API key edit dialog open while selecting items from portalled model/account menus — including when the dropdown is dismissed by a mouse click on the backdrop.

Type of change

  • fix: bug fix

Linked issue: None

OpenSpec

  • This PR includes or updates an OpenSpec change

Change directory: openspec/changes/fix-dashboard-responsive-select-dismissal

Changes

  • Keep a modal open when an "outside" interaction is really the user dismissing a nested floating layer (Radix Select / DropdownMenu / Popover):
    • exempt interactions whose target is inside a floating layer;
    • also exempt the case where a floating layer is open and the user clicks the backdrop to dismiss it — captured at pointerdown on the capture phase, so it survives Radix closing the dropdown (its data-state flips to closed) before the dialog's own outside handler runs (the race that made mouse clicks still close the dialog).
  • Extract the guard into a shared useFloatingLayerDismissGuard hook consumed by DialogContent and SheetContent. AlertDialog is intentionally left alone — it is non-dismissible on outside interaction by design.
  • Make Accounts page panels and account controls fit narrow viewports without horizontal overflow.
  • Add regression tests for both cases.

Test plan

git diff --check
npm run lint
npm run build
npm run test
openspec validate --specs

Results:

  • git diff --check passed.
  • npm run lint passed.
  • npm run build passed.
  • npm run test passed: 101 files, 632 tests.
  • openspec validate --specs blocked locally: openspec is not installed in this shell.

Checklist

  • Title is in Conventional Commits format.
  • No related issue.
  • Added or updated tests covering the change.
  • Ran the relevant frontend checks locally.
  • OpenSpec validation passes. Blocked locally: openspec is not installed in this shell.
  • CHANGELOG is not edited by hand.

qdzsh added 4 commits June 21, 2026 20:59
The earlier dialog fix only exempted clicks landing inside a floating layer
(Select/DropdownMenu/Popover content). But the multi-select dropdowns in the
Edit API key dialog (Allowed models, Assigned accounts) use a DropdownMenu, and
dismissing them by clicking the backdrop produces an outside event whose target
is outside every layer -> the dialog closed too, so Save was unreachable.

Add a guard: while any floating layer is open (data-state=open), treat the
dialog's focus/interact/pointer-outside events as dismissing that layer, not the
dialog, and preventDefault. Also include the radix popper wrapper in the target
allowlist for robustness.
… race

A mouse click outside an OPEN dropdown closed the dialog: Radix dismisses the
dropdown first (flipping data-state to closed), so the dialog's outside handler
saw no open layer on its live check and closed too. Esc worked because it does
not go through the outside-pointer path.

Capture isFloatingLayerOpen() in a document pointerdown listener on the CAPTURE
phase (runs before Radix's bubble-phase dismiss listeners, while the dropdown is
still open) and consult that captured flag in the dialog's outside handlers.
Extract the dialog's nested-floating-layer dismiss guard (target allowlist +
capture-phase open-state flag) into a reusable useFloatingLayerDismissGuard hook
and consume it from DialogContent. Apply the same guard to SheetContent, which
is built on the Dialog primitive and shares the close-on-outside behaviour, so a
future Select/dropdown inside a Sheet will not close the sheet.

AlertDialog is intentionally left as-is: Radix AlertDialog is non-dismissible on
outside pointer interaction by design (it omits those handlers), so it cannot hit
this bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant