Skip to content

Removing of overflow: hidden on html happens before transition finished when closing Dialog #2525

Closed
@xsjcTony

Description

@xsjcTony

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

For example: v1.7.15

What browser are you using?

For example: Chrome

Reproduction URL

https://stackblitz.com/edit/vitejs-vite-kgljjr?file=src%2FApp.tsx

Describe your issue

As described in the title, and please refer to my reproduction

This will cause a small flick when closing Dialog when there's a transition applied since the scrollbar appears before the transition ends.
It's working properly when opening Dialog since the scrollbar is disabled before the transition starts.

This is especially obvious when working with consequence modals, where the flick is really not ideal.

I'm aware that in #365 , you have added a padding-right to the html to let the content stop shifting, but it's not applied to the modal.


One possible workaround is to add another right-[calc(100%-100vw)] to the modal content container like this

<div className="fixed inset-0 right-[calc(100%-100vw)]">
  {content}
</div>

But it's not that ideal... even with this workaround, although the modal stops shifting, but the scrollbar will still appear for the leaving transition period... it's acceptable for single modal, but definitely not for consequence modals (a blink).
The ultimate solution should be only to remove overflow: hidden on html after the transition is completed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions