Closed dmarkow closed 2 years ago
Thanks for reporting this @dmarkow. I am able to reproduce this issue, but haven't been able to find a solution yet. I'm going to do some more digging and will report back. 👍
Hey @dmarkow, another update here. We've spent a bunch of time working out the right solution to this problem, and it's unfortunately pretty complex. I'm pretty sure we know how to fix this now, but it's going to require some changed upstream in the Headless UI package. Because this is a bigger change, it might take a few weeks to get it implemented. I'm going to leave this issue open until that's been completed.
@reinink No worries, I appreciate any time spent on it! I have a workaround for now that's getting the job done.
@dmarkow If you don't mind me asking, whats your workaround. using overflow on the modal body ?
@nourkilany we added a right offset to the overlay (we ended up using a specific pixel size instead of a tailwind preset, I don't remember why at this point):
<Dialog.Overlay className="fixed inset-0 right-[17px] bg-black opacity-50" />
Okay, this has finally been fixed! 🥳
This ended up being a pretty tricky problem to solve, and actually required us making changes to the Headless UI dialog component. We've deprecated the <Dialog.Overlay>
component and added a new <Dialog.Panel>
component, and have updated all the modals in Tailwind UI to use this new component.
To upgrade your dialogs, please see the migration guide here: https://github.com/tailwindlabs/headlessui/releases/tag/%40headlessui%2Fvue%40v1.6.0
What component (if applicable)
Describe the bug If a modal has more content than fits on the screen, you can scroll the modal up and down while the underlying content stays static (great!). However, at least on Windows, you can only scroll using the mouse scroll wheel or trackpad scrolling. The overlay in the example has
inset-0
which effectively covers up and scrollbars that appear.To Reproduce Steps to reproduce the behavior:
Expected behavior The scrollbar should be usable and shouldn't close the modal when you click it.
Screenshots
Browser/Device (if applicable)
Additional context For now, I'm using
top-0 left-0 bottom-0 right-4
instead ofinset-0
on my overlay, but it has the downside of having a 16px gap even when there are no scrollbars visible.@headlessui seems to have some logic where it sets the
html
element's right padding based on if scrollbars are present, I'm wondering if the Tailwind UI components need to do something similar with the overlay?