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.

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

1.4.1

What browser are you using?

Chrome

Reproduction repository

none

Describe your issue

I’m using the following Context Provider to handle two dialog states:

  • Modal Provider
  • Alert Provider

The Modal provider opens a Dialog with a form that when submitted adds products to the user’s cart. The Alert provider opens a Dialog - Alert Popup.

In the following scenario, a user intends to add a product to their cart. The Modal Dialog is set to open. Upon submission the Modal Dialog is set to false to disable and close the Dialog.

After the Modal Dialog is set to close, I set the Alert Provider to open, in order to display a Success Alert to the user confirming their product has been added to their cart.

The issue is the following: After the Modal Dialog is closed and the Alert Dialog opens, the <html> element gets overflow: hidden. This is usually expected, but not once a user clicks to close the Dialog. In my case I close the Alert Dialog, but the overflow: hidden is added on the close. As you can tell in the GIF below, while the Alert Dialog is open a user can scroll. But once he/she closes the Dialog, the user can no longer scroll. It seems that the order of the events are incorrect.

Just to point out this error only happens in the case where a user submits the Modal Dialog form and then the Success Dialog appears.

TailwindUIIssue

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
juanzgccommented, Jan 26, 2022

@okbill If you create a new issue do you mind tagging me or including the issue number here as well.

Yes, I’m still able to reproduce @RobinMalfait

would it be possible to re-open this issue?

1reaction
juanzgccommented, Oct 22, 2021

Temporary solution to the problem:

Upon submit form within Modal, wrap the success alert within a timeout (I set it to 500ms), so that we give the DOM some time to remove the overflow: hidden and re-add it in time for the Success Alert.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug Definition & Meaning - Merriam-Webster
noun (1) · 1. a · 2. : an unexpected defect, fault, flaw, or imperfection · 3. a · 4. : a concealed...
Read more >
Bug (2006) - IMDb
An unhinged war veteran holes up with a lonely woman in a spooky Oklahoma motel room. The line between reality and delusion is...
Read more >
bug - Wiktionary
(entomology) An insect of the order Hemiptera (the “true bugs”). Any of various species of marine or freshwater crustaceans; e.g. a Moreton Bay...
Read more >
Bug - Wikipedia
A terrestrial arthropod animal (with at least six legs). Insect, a six-legged arthropod · Covert listening device, used in surveillance, espionage and policing ......
Read more >
BUG | definition in the Cambridge English Dictionary
bug noun (INSECT) ... an insect: Some tiny white bugs had eaten the leaves of my house plants. ... A bug is also...
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