Fix team-status dropdown spurious self-close on dispatch board - #15
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Popoverimmediately closes after opening when using the DatePicker code example adobe/react-spectrum#4533), not a bug in this app's state management.onOpenChange(false)if it fires within 150ms of opening and wasn't the result of an actual selection. Real users never dismiss a just-opened menu that fast, so this only suppresses the spurious closes.Investigation trail (see issue #14 for full detail)
Instrumented a local repro against the Firebase emulator and ruled out, empirically, in order:
motionProps(framer-motion) — removed entirely, bug persisted at the same ~50-60% failure rate.shouldCloseOnBlur={false}— no effect, bug persisted.The close-guard fix was then verified to eliminate the failures.
Test plan
npm run type-check— cleannpm run lint— clean (no new warnings/errors)🤖 Generated with Claude Code