[Bug]:
See original GitHub issueWhat package within Headless UI are you using?
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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
@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?
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.