Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headlessui-portal-root doesn't delete on modal close (random) #1391

Closed
sgehrman opened this issue May 2, 2022 · 9 comments · Fixed by #1432
Closed

headlessui-portal-root doesn't delete on modal close (random) #1391

sgehrman opened this issue May 2, 2022 · 9 comments · Fixed by #1432

Comments

@sgehrman
Copy link

sgehrman commented May 2, 2022

"@headlessui/react": "^1.6.0",

I have a dialog. I use the sample code on the headless site.

I click a button to open the dialog, and I close it by hitting buttons on the dialog or clicking outside dialog.

I see the headlessui-portal-root appear and disappear, but eventually it gets stuck. headlessui-portal-root stays there and I can't click on my webpage (being blocked by overlay?)

@RobinMalfait
Copy link
Member

Hey! Thank you for your bug report!
Much appreciated! 🙏

Can you create a reproduction repo / CodeSandbox and attach it so that we can help you out?

@soulsam480
Copy link

just saw this issue on my app too. can be reproduced by opening a dialog inside mobile device emulation of inspect element. headless ui version 1.6.0

@RobinMalfait
Copy link
Member

@soulsam480 can you please provide a reproduction repo / CodeSandbox that showcases this issue? Can't reproduce it: https://headlessui-react-j675qve7g-tailwindlabs.vercel.app/dialog/dialog

@soulsam480
Copy link

Will do it today.

@Axedyson
Copy link

Axedyson commented May 3, 2022

@DanielHoffmann
Copy link

DanielHoffmann commented May 4, 2022

I can confirm this happens on v1.6.0 and on v1.6.1 which was just released. I managed to work around this issue by using as="div" instead of as={React.Fragment} in Dialog and Transition

as={React.Fragment} is the way it is used in the documentation, so I guess updating the docs to add this detail is also a valid solution

This seems related to the component trying to manually remove actual DOM nodes from the root of the page and React.Fragment doesn't render as a DOM node

Downgrading to v1.5.0 also fixes the problem

@RobinMalfait
Copy link
Member

This should be fixed by #1432, and will be available in the next release.

You can already try it using npm install @headlessui/react@insiders.

@nirix
Copy link

nirix commented May 12, 2022

I ran into this issue with v1.6.1. Switching to the insiders version didn't solve the issue.

  • React 18.1
  • React DOM 18.1
  • @headlessui/react@0.0.0-insiders.bf0d112

@RobinMalfait
Copy link
Member

@nirix can you create a reproduction repo so that we can take a look?

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 a pull request may close this issue.

6 participants