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.Overlay doesn't close together with Dialog on latest main commit (591b328)

See original GitHub issue

What package within Headless UI are you using?

@headlessui/react@insiders.591b328

What browser are you using?

Firefox

Describe your issue

Not sure if it’s only affecting me, but I’m using the current insiders version and Dialog.Overlay stays visible even when you close the Dialog it belongs to, blocking inputs to the underlying page. I reverted to commit ab6310 and this issue went away, but it also resulted in issues with using datepickers in modals (i.e. the fix that was supposed to come with this pull request doesn’t work, and clicking inside a datepicker in a dialog will cause the dialog to close. https://github.com/tailwindlabs/headlessui/pull/1268).

EDIT: I have come to realise that strangely, this bug only happens IF you have an opacity class on the Dialog.Overlay component. For example the overlay closes if it looks like that:

<Dialog.Overlay className="fixed inset-0 bg-black"/>

but does NOT close if it’s like that:

<Dialog.Overlay className="fixed inset-0 bg-black opacity-30"/>

I’m using a Transition for this overlay just like in this codesandbox that was posted when fixing #432

After some further testing, removing the surrounding <Transition> tag fixes the issue, so there’s probably some conflict with transitioning the opacity.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:6
  • Comments:6

github_iconTop GitHub Comments

4reactions
spvncommented, Apr 21, 2022

Will create one when I’m free, but just FYI the sample code for Dialog on the website will break. I’m referring to the sample dialog at the top of this page: https://headlessui.dev/react/dialog

Removing as={Fragment} from Dialog.Overlay’s <Transition.Child> fixes the problem

1reaction
StwardPCcommented, Nov 28, 2022

Removing as={Fragment} from Dialog.Overlay’s <Transition.Child> fixes the problem

This solved the issue on my end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dialog won't close on background/overlay click - Stack Overflow
When I click on the find box the correct dialog comes up, but it can only be closed by clicking it's own close...
Read more >
Commit dialog doesn't show when the summary line is too ...
Commit dialog doesn't show when the summary line is too long for git. ; Project, IntelliJ IDEA ; Priority, Normal N ; Type,...
Read more >
A Git client for Windows Version 2.13.0 - TortoiseGit
The commit dialog supports changelist feature to help with grouping related files together. Find out about this feature in Section 2.13, “Change Lists”....
Read more >
EGit/User Guide - Eclipsepedia
This will open the Push Confirmation dialog showing a preview which changes will be pushed to the destination repository. If this does not...
Read more >
Settings — GitExtensions 3.4 documentation
To see more commits, then this setting will need to be adjusted and Git Extensions restarted. Behaviour ¶. Close Process dialog when process...
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