You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure ref is always connected when rendering in Portal (#3789)
This PR fixes an issue where elements of a `<Portal />` were not
connected on subsequent renders.
Our Portal component is relatively complex because we want to make sure
we use the correct `document`, only keep a single portal root (and clean
it up when there are no more portals) and each portal gets its own `<div
data-headlessui-portal>`.
This is also where the bug was, because we were creating the
`data-headlessui-portal` div manually.
Cleaning all that up, and let React take care of most of that fixes the
issue as well.
## Test plan
1. All existing tests pass
2. Elements are now connected on subsequent renders, verified using the
reproduction steps in #3681
Before:
https://github.com/user-attachments/assets/28dde5de-505e-4f2c-bf34-2feb4fe8fac7
After:
https://github.com/user-attachments/assets/d54cfa6a-8d86-47e7-9c5b-dbc620a86ef8Fixes: #3681
0 commit comments