@headlessui/react 2.2.10: Dialog stays mounted at opacity-0 after enter-transition race (React 19.3.1, scheduler delayed by 80 ms)
Comments · 0
Be the first to comment.
Bug reportby SceneRecap AI
Repro steps
- 1.Open the headlessui/react#3902 reproduction page. The status box says the repro has not run yet.
- 2.Click the "+1 click" probe button three times to confirm the page is interactive (control).
- 3.Click "Run reproduction". The page opens the Dialog, calls setOpen(false) 60 ms later during the enter transition, and delays React's scheduler by 80 ms.
- 4.Watch the status box and try to use the "+1 click" probe button again.
Expected
After setOpen(false), the Dialog finishes or cancels its transition and unmounts. The dialog[role=dialog] wrapper is removed from the DOM and the page stays interactive, so "+1 click" keeps incrementing the counter.
Actual
The dialog wrapper stays in the DOM at opacity-0. The status box reports STUCK with dialog[role=dialog] still in DOM. The page is dimmed under a grey overlay, and the full-screen invisible wrapper intercepts pointer events. The probe counter stays frozen at 3 and a note reads "click intercepted by invisible dialog backdrop". The page stays non-interactive until the recording ends.
Evidence
Issue markdown (copy-paste ready)
## Summary In `@headlessui/react` 2.2.10 with React 19.3.1, calling `setOpen(false)` 60 ms after opening a `Dialog` leaves the dialog mounted. In this repro the enter transition is still running at that point and React's scheduler is delayed by 80 ms. The `dialog[role=dialog]` wrapper stays in the DOM at `opacity-0`. Its full-screen wrapper intercepts all pointer events, so the page becomes unusable. ## Environment - Browser: Chromium 151.0.7922.34 - OS: macOS - Viewport: 1280x720, DPR 1 - Locale / TZ: en-US / Europe/Berlin - @headlessui/react 2.2.10, React 19.3.1 (per report title) ## Steps to reproduce 1. Open the headlessui/react#3902 reproduction page (1.0s). Status says the repro has not run yet. 2. Click "+1 click" three times to confirm the page is interactive (5.0s, 5.8s, 6.5s). 3. Click "Run reproduction" (8.5s). 4. Observe the status box and try the "+1 click" probe again (11.0s onward). ## Expected The Dialog unmounts after `setOpen(false)`. No `dialog[role=dialog]` remains in the DOM, and the "+1 click" probe keeps incrementing. ## Actual - At 11.0s the status box shows: "STUCK: dialog[role=dialog] still in DOM. Full-screen wrapper (opacity-0) intercepts all pointer events." - The whole page is dimmed under a grey overlay from 11.0s. - At 13.0s a note reads "click intercepted by invisible dialog backdrop". The counter stays frozen at 3. - The page is still blocked at 17.0s, the end of the recording. ## Control (works) Before running the repro, the probe button works normally. The counter goes from 0 to 2 by 6.5s and to 3 by 8.5s. Pointer input is fine until the race is triggered. ## Suspected area Dialog / Transition unmount logic when `open` becomes false during an in-flight enter transition while React commits are delayed. The transition state machine seems to never reach the unmounted state. The wrapper stays rendered at `opacity-0` and keeps receiving pointer events. *Recorded with SceneRecap.*
This report was written by SceneRecap from a screen recording. Try SceneRecap free
Turn a screen recording into a bug report like this one.
Repro steps, expected vs actual and the console and network evidence, each with a timestamp. On every plan, Free included.
Try SceneRecap free →