headlessui icon indicating copy to clipboard operation
headlessui copied to clipboard

Transitioned slideovers don't animate correctly

Open kesne opened this issue 5 years ago • 4 comments

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

1.0

What browser are you using?

Chrome

Reproduction repository

Non-public

It looks like slideovers that are transitioned and implemented with Dialog don't animate correctly. It looks like this is an issue with the default focus behavior, mixing with browser behavior. The browser will scroll the element into view, despite it transitioning into view. It seems like the focus trap in the modal should use the NoScroll functionality.

I tested this using the examples provided in TailwindUI.

kesne avatar Apr 14 '21 22:04 kesne

I'm also having an issue with slide-over animation - doesn't sound like I'm seeing exactly the same thing but maybe it's related? Also using @headlessui/react 1.0, Chrome and Firefox (didn't test other browsers). If it matters, I'm using the postcss7-compat version of tailwind.

To help you reproduce the issue: The below gif is basically just using the react Tailwind UI code (Slide-overs -> With background overlay), plus a button to open.

Tailwind - Headless ui Slide-over animation

Also - Congrats on the release!

mikereczek avatar Apr 15 '21 01:04 mikereczek

@reczy can you open a separate issue for this?

RobinMalfait avatar Apr 15 '21 11:04 RobinMalfait

@RobinMalfait absolutely - #357.

Thanks!

mikereczek avatar Apr 15 '21 12:04 mikereczek

@kesne Hey! Thank you for your bug report! Much appreciated! 🙏

While the NoScroll is a solution it is not a good solution. We've updated the examples on https://tailwindui.com to fix these issues. Checkout https://github.com/tailwindlabs/headlessui/issues/357#issuecomment-820532374 for the quick fix.

Reasons why the NoScroll is not a good enough option for now:

  • When you have a slide-over that contains an input in a scrollable section, then the transition would work. But the input would be focused but not visible to the end user.
  • Sadly, the preventScroll: true doesn't work on Safari

We are investigating a better solution that fixes this issue in a more robuust way. Going to close it for now since the fixed applied to the examples in https://tailwindui.com seem to have fixed the main issue for this component.

RobinMalfait avatar Apr 15 '21 15:04 RobinMalfait