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

Add transition-behavior utilities #12149

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

lukewarlow
Copy link
Contributor

@lukewarlow lukewarlow commented Oct 5, 2023

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 #12040 for a related PR to add a @starting-style variant.

See #12148 for a semi-related PR to add a :popover-open variant.

'.transition-allow-discrete': { 'transition-behavior': 'allow-discrete' },
'.transition-behavior-normal': { 'transition-behavior': 'normal' },
})
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure on the exact best class names for this?

@lukewarlow
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@brandonmcconnell
Copy link
Contributor

@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

@lukewarlow
Copy link
Contributor Author

WebKit/standards-positions#148

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

@lukewarlow
Copy link
Contributor Author

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

@lukewarlow
Copy link
Contributor Author

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

@brandonmcconnell
Copy link
Contributor

@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.

@RobinMalfait RobinMalfait changed the base branch from master to archive/master-2024-02-23 March 4, 2024 21:46
Co-authored-by: Luke Warlow <luke@warlow.dev>
@RobinMalfait RobinMalfait changed the base branch from archive/master-2024-02-23 to next April 17, 2024 21:27
@RobinMalfait
Copy link
Contributor

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 💪

@brandonmcconnell
Copy link
Contributor

Congrats, @lukewarlow!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants