question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Dialog: portal DOM node isn't removed anymore

See original GitHub issue

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v1.6.1

What browser are you using?

Chrome

Reproduction

  1. open sandbox (v1.6.1)
  2. reduce the window size so that mobile layout will be used
  3. open the sidebar via the menu button
  4. make the window width bigger, so that it will switch back to the desktop layout (sidebar have to be open still)
  5. reduce the window size so that mobile layout will be used again
  6. try to open the sidebar again via the menu button -> it isn’t working Reproduction URL

Not Working with v1.6.1

Edit @headlessui/dialog bug

Working with v1.5.0

Edit @headlessui/dialog bug 1.5.0

Describe your issue

Since v1.6.0 and the change regarding the Dialog.Panel component, there is a bug where the added portal DOM node isn’t removed from the DOM anymore, when the Dialog component is hidden by CSS.

In the sandbox i’m using tailwindUI´s sidebar template. Here is also a video demonstrating the issue.

https://user-images.githubusercontent.com/2396344/167178415-df757a53-38cc-4ed6-bec8-52445c251325.mov

Prior to v1.6.0 it was working fine.

Thx in advance for your help and support!!

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:10
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
nirixcommented, May 12, 2022

In the app I’m working on (private repo) I’ve run into this issue using the Dialog component with transitions.

I have a modal that contains a button to close the modal, the following steps will reproduce the issue:

  • Open modal
  • Click button to close modal
  • Repeat a couple of times, no matter how fast or slow
  • Portal DOM element remains, Dialog disappears due to a fade-out transition, but remains on the page, blocking clicks

The issue does not happen if using escape or clicking outside the dialog to close.

Just to reiterate, the issue only happens when using an element inside the Dialog to close it, I thought it had something to do with my code but I did a straight copy/paste from the examples and still ran into the issue.

3reactions
lmlorcacommented, May 28, 2022

Can confirm, same issue. Clicking a close button inside the Dialog freezes the app. For now using 1.5.0 solves the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle heavy resource/DOM on React Portal - Stack Overflow
Just include a permanent empty div with no style (no need to use any display rules), and it will just receive all HTML...
Read more >
Using React Portals to build a modal - LogRocket Blog
Learn how to build a modal or overlay component in React with React Portals. Our demo is applicable for all top level components....
Read more >
Portals - React
Portals. Portals provide a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component....
Read more >
Changelog - Cypress Documentation
Fixed a bug where projects using Node.js 16.17+ and 18.6+ with ES Modules and TypeScript were not working with Cypress. Fixes #22795, #23393,...
Read more >
LTS Changelog - Jenkins
major bug fix; bug fix; major enhancement; enhancement. Community feedback: no major issues; notable issues; required rollback.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found