Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: Animation stuttering on Sheet component after update tailwind v3 to v4 #6440

Open
2 tasks done
OYERA1 opened this issue Jan 24, 2025 · 6 comments
Open
2 tasks done
Labels
bug Something isn't working tailwind

Comments

@OYERA1
Copy link

OYERA1 commented Jan 24, 2025

Describe the bug

Sheet component somehow looses the smooth animation.
Idk if updating tailwind v3 to v4 is related to the problem, but i tryed one version before the update and the sheet component opened smoothly without any problem.

Bad opening

Gravacao.de.tela.de.2025-01-24.03-07-01.mp4

Expected opening

Gravacao.de.tela.de.2025-01-24.03-15-29.mp4

Affected component/components

Sheet

How to reproduce

  1. Install Sheet component
  2. Build the component
  3. Test
  4. Update Tailwind v3 to v4
  5. Click in the trigger component

Codesandbox/StackBlitz link

No response

Logs

System Info

Fedora 41, Firefox-Aurora, NextJs 15.1.4, Tailwindcss 4.0.0, @tailwindcss/postcss ^4.0.0

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@OYERA1 OYERA1 added the bug Something isn't working label Jan 24, 2025
@OYERA1 OYERA1 changed the title [bug]: Stutter animation on Sheet component after update tailwind v3 to v4 [bug]: Animation stuttering on Sheet component after update tailwind v3 to v4 Jan 24, 2025
@vishdadhich092004
Copy link

facing the same issue!

@sami616
Copy link

sami616 commented Jan 24, 2025

The alert dialog and dialog animations also appear to be broken

@dez1729
Copy link

dez1729 commented Jan 24, 2025

This issue also applies to Dialog in general, as now the opening/closing animation going to the top left whereas the original behavior was animating to/from the middle.

@arxkdev
Copy link

arxkdev commented Jan 26, 2025

Yeah, issue with mine too. Command component is coming from the top left to the center rather than to/from the center.

My solution:
Inside Dialog.tsx:

Instead of:

const DialogContent = React.forwardRef<
  React.ElementRef<typeof DialogPrimitive.Content>,
  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
  <DialogPortal>
    <DialogOverlay />
    <DialogPrimitive.Content
      ref={ref}
      className={cn(
        "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
        className
      )}
      {...props}
    >
      {children}
      <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
        <X className="h-4 w-4" />
        <span className="sr-only">Close</span>
      </DialogPrimitive.Close>
    </DialogPrimitive.Content>
  </DialogPortal>
))

I did:

const DialogContent = React.forwardRef<
  React.ElementRef<typeof DialogPrimitive.Content>,
  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
  <DialogPortal>
    <DialogOverlay />
    <DialogPrimitive.Content
      ref={ref}
      className={cn(
        "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",
        className
      )}
      {...props}
    >
      {children}
      <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
        <X className="h-4 w-4" />
        <span className="sr-only">Close</span>
      </DialogPrimitive.Close>
    </DialogPrimitive.Content>
  </DialogPortal>
))

@arxkdev
Copy link

arxkdev commented Jan 26, 2025

I'm running TailwindCSS v4 with shadcn/ui fine, and I use a lot of shadcn components. This was maybe just 1 of 2 issues I found.

I believe they also removed default cursor-pointer behavior to buttons, so you need to go around and add that behavior yourself. I'm not 100% certain on that so correct me if I'm wrong.

@dez1729
Copy link

dez1729 commented Jan 26, 2025

The cursor was definitely an intended change based on #8962 among others.

martinfrancois added a commit to martinfrancois/question-driven-talk-assistant that referenced this issue Jan 27, 2025
Change was brought in by an incorrect automatic migration by tailwind.
See shadcn-ui/ui#6440
martinfrancois added a commit to martinfrancois/question-driven-talk-assistant that referenced this issue Jan 27, 2025
Change was brought in by an incorrect automatic migration by tailwind.
See shadcn-ui/ui#6440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tailwind
Projects
None yet
Development

No branches or pull requests

6 participants