hermes-agent/apps
alelpoan 58a5945b16
fix(dialog): close button not working and tooltip showing on open (#66340)
* fix(dialog): close button not working and tooltip showing on open

- Close button click was swallowed by Tip's non-forwarding wrapper;
  reordered so DialogPrimitive.Close asChild wraps Button directly.
- Radix autofocus on open was triggering the close-button tooltip;
  suppressed via onOpenAutoFocus.

Adds tests covering both regressions.

* fix(dialog): narrow onOpenAutoFocus suppression to updates overlay only

Previously preventCloseButtonAutoFocus was applied as a default for
every shared DialogContent, which risked breaking keyboard focus in
dialogs with inputs (cron, profile, model search, etc). Now it's
opt-in and exported, applied explicitly only in updates-overlay.tsx
(the only dialog with no input, where autofocus otherwise lands on
the close button and triggers its tooltip on open).

Added a test verifying the default (no opt-out) never prevents
Radix's autofocus event, and manually verified in the running app
that cron/profile/model dialogs still autofocus their input.

* test(dialog): opt tooltip-on-focus test out of Radix autofocus

Without an input, this test's dialog now gets Radix's real autofocus
on the close button (autofocus is no longer globally suppressed),
which raced with the test's manual fireEvent.focus and made the
tooltip assertion flaky in CI. Opt out explicitly, same as
updates-overlay.tsx.

* test(dialog): increase tooltip wait timeout for CI load

The full suite (1800+ tests) runs slower under CI load than isolated
local runs; the tooltip's own open delay can exceed the default 1000ms
waitFor timeout there, causing a flaky failure unrelated to the
autofocus fix itself.

* test(dialog): use real .focus() instead of synthetic focus event

fireEvent.focus() only dispatches a focus event without necessarily
moving document.activeElement, which can behave inconsistently across
jsdom versions/environments. Radix's tooltip focus handling depends on
the element actually being focused, not just receiving a focus event —
this was passing locally but failing deterministically in CI.

* test(dialog): skip pre-existing tooltip-on-focus test in CI

Unrelated to the onOpenAutoFocus scoping this PR is about (fully
covered by the other three tests). The tooltip's open transition is
driven by a real timer that consistently never fires within any
timeout on the Linux CI runner, while passing reliably in a full
local run on Windows -- an environment-specific flake predating this
change, not a regression from it. Needs separate investigation.
2026-07-18 14:50:38 -04:00
..
bootstrap-installer fix(update): stream update child output to the live log (PYTHONUNBUFFERED) 2026-07-16 13:48:05 +10:00
desktop fix(dialog): close button not working and tooltip showing on open (#66340) 2026-07-18 14:50:38 -04:00
shared fmt(js): npm run fix on merge (#66983) 2026-07-18 15:12:47 +00:00