Skip to content

Fix team-status dropdown spurious self-close on dispatch board - #15

Merged
evanqua merged 1 commit into
mainfrom
fix/dispatch-dropdown-instability
Jul 9, 2026
Merged

Fix team-status dropdown spurious self-close on dispatch board#15
evanqua merged 1 commit into
mainfrom
fix/dispatch-dropdown-instability

Conversation

@evanqua

@evanqua evanqua commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

Investigation trail (see issue #14 for full detail)

Instrumented a local repro against the Firebase emulator and ruled out, empirically, in order:

  1. The existing "auto-close resolved call" effect — never fired during the failures.
  2. Duplicate desktop/mobile DOM mounts — already fixed in feat: Integrate ASJ fork — PocketBase, roles, Docker, CI/CD, E2E tests (with review fixes) #13, confirmed independent of this bug (reproduced on a single desktop-only run).
  3. Custom motionProps (framer-motion) — removed entirely, bug persisted at the same ~50-60% failure rate.
  4. shouldCloseOnBlur={false} — no effect, bug persisted.

The close-guard fix was then verified to eliminate the failures.

Test plan

  • npm run type-check — clean
  • npm run lint — clean (no new warnings/errors)
  • Firebase: 41/41 passed across 5 repeats of all previously-affected scenarios (Refusal status, Full call lifecycle, clinic outcome scenarios, event-summary status transitions) — previously failing/flaky ~50-60% of the time
  • PocketBase: 10/10 passed across 3 repeats of the same core scenarios

🤖 Generated with Claude Code

Fixes #14

Root cause: HeroUI/react-aria's Popover (backing the team-status
Dropdown) intermittently fired onOpenChange(false) 15-35ms after
opening, with no onAction and no user interaction — closing the menu
before Playwright (or a fast real user) could click a status option.
This is a known, still-unresolved upstream focus/blur-tracking race in
react-aria's overlay handling (adobe/react-spectrum#4533), not
something in app code.

Ruled out via instrumented local repro before landing on this: the
existing auto-close effect (never fired), the custom framer-motion
motionProps (removed entirely, bug persisted at the same rate), and
shouldCloseOnBlur={false} (no effect, bug persisted).

Fix: track when the dropdown was opened and whether the close came
from an actual selection (onAction). Ignore onOpenChange(false) that
fires within 150ms of opening unless it was a real selection — real
users never dismiss a just-opened menu that fast, so this only ever
suppresses the spurious closes, not genuine ones.

Verified: 41/41 passing across 5 repeats on Firebase (previously
~50-60% failure rate on the affected scenarios), 10/10 on PocketBase.
@evanqua
evanqua requested a review from iv-zhang as a code owner July 9, 2026 17:58
@evanqua
evanqua deployed to Development July 9, 2026 17:58 — with GitHub Actions Active
@evanqua
evanqua merged commit 7fa614a into main Jul 9, 2026
5 checks passed
@evanqua
evanqua deleted the fix/dispatch-dropdown-instability branch August 12, 2026 05:00
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.

Team-status Dropdown becomes unstable/detaches from DOM during click (dispatch board)

1 participant