Commit ce9b290
authored
We introduced an accidental breaking change a few months ago in 4.1.5
with tailwindlabs#17812.
We added `visibility` to the property list in `transition` which
unfortunately only applies its change instantly when going from
invisible -> visible.
I've checked `display`, `content-visibility`, and `pointer-events` and
they apply their change instantly (as best I can tell) when
transitioning by default. And `overlay` only "applies" for discrete
transitions so it can stay as well.
The spec has this to say about [animating
`visibility`](https://www.w3.org/TR/web-animations-1/#animating-visibility):
> For the visibility property, visible is interpolated as a discrete
step where values of p between 0 and 1 map to visible and other values
of p map to the closer endpoint; if neither value is visible then
discrete animation is used.
This means that for visible (t=0) -> hidden (t=1) the timeline looks
like this:
- t=0.0: visible
- t=0.5: visible
- t=0.999…8: visible
- t=1.0: invisible
This means that for invisible (t=0) -> visible (t=1) the timeline looks
like this:
- t=0.0: invisible
- t=0.000…1: visible
- t=0.5: visible
- t=1.0: visible
So the value *is* instantly applied if the element is initially
invisible but when going the other direction this is not the case. This
happens whether or not the transition type is discrete.
While the spec calls out [`display` as working
similarly](https://drafts.csswg.org/css-display-4/#display-animation) in
practice this is only the case when `transition-behavior` is explicitly
set to `allow-discrete` otherwise the change is instant for both
directions.
Fixes tailwindlabs#18793
1 parent e4c0255 commit ce9b290
File tree
3 files changed
+7
-3
lines changed- packages/tailwindcss/src
3 files changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22091 | 22091 | | |
22092 | 22092 | | |
22093 | 22093 | | |
22094 | | - | |
| 22094 | + | |
22095 | 22095 | | |
22096 | 22096 | | |
22097 | 22097 | | |
| |||
22153 | 22153 | | |
22154 | 22154 | | |
22155 | 22155 | | |
22156 | | - | |
| 22156 | + | |
22157 | 22157 | | |
22158 | 22158 | | |
22159 | 22159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4504 | 4504 | | |
4505 | 4505 | | |
4506 | 4506 | | |
4507 | | - | |
| 4507 | + | |
4508 | 4508 | | |
4509 | 4509 | | |
4510 | 4510 | | |
| |||
0 commit comments