tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Add `transition-behavior` utilities

Open lukewarlow opened this issue 7 months ago • 9 comments

transition-behavior is a new CSS property that allows you to transition on discrete properties.

This is new in Chrome 117. See https://chromestatus.com/feature/5071230636392448

One major use case for this is styling dialog and popover transitions when showing. (See comment for exit transitions)

See https://github.com/tailwindlabs/tailwindcss/pull/12040 for a related PR to add a @starting-style variant.

See https://github.com/tailwindlabs/tailwindcss/pull/12148 for a semi-related PR to add a :popover-open variant.

lukewarlow avatar Oct 05 '23 22:10 lukewarlow

It would also be good to add a utility for transition: overlay. https://drafts.csswg.org/css-position-4/#overlay

The overlay property shipped in Chrome 117 See https://chromestatus.com/feature/5138724910792704

While transition-behavior allows styling entry animations for popover and dialog for exit animations you need transition-property to include overlay

See https://developer.chrome.com/en/blog/new-in-chrome-117/#exit-entry-animations for a good example.

lukewarlow avatar Oct 05 '23 22:10 lukewarlow

See https://developer.chrome.com/blog/entry-exit-animations/ for a good overview on all these new capabilities in Chrome

lukewarlow avatar Oct 05 '23 22:10 lukewarlow

@lukewarlow I've been wanting a CSS property like that for years! 🙌🏼

For a Tailwind CSS implementation, I think we may want to wait until at least all modern browsers implement the feature: https://caniuse.com/mdn-css_properties_transition-behavior

brandonmcconnell avatar Oct 12 '23 02:10 brandonmcconnell

https://github.com/WebKit/standards-positions/issues/148

WebKit have a positive standards position on this and look like they have it implemented as well.

lukewarlow avatar Dec 15 '23 17:12 lukewarlow

This is part of Interop 2024 so should be in all 3 browsers by the end of the year

lukewarlow avatar Feb 28 '24 14:02 lukewarlow

I have no clue what's happened to the branch and why there's so many conflicts and commits but I imagine it's a simple fix

lukewarlow avatar Feb 28 '24 14:02 lukewarlow

@lukewarlow Yeah, that's happened to some of mine in the past too. Usually, they just have to rebase it on the latest main/master branch.

brandonmcconnell avatar Feb 29 '24 08:02 brandonmcconnell

Hey!

You might have noticed that I forced pushed to this branch. The reason is because the PR now uses next as the base branch which is our working branch for Tailwind CSS v4. In other words, the feature you implemented here is now written in the new codebase.

The code is ported as-is, so no API changes of your feature happened while moving it to the new codebase.

I also made sure to add you as a co-author because you still deserve all the credit 💪

RobinMalfait avatar Apr 17 '24 21:04 RobinMalfait

Congrats, @lukewarlow!

brandonmcconnell avatar Apr 17 '24 23:04 brandonmcconnell