-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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.