Skip to content

Commit ce9b290

Browse files
Don't transition visibility when using transition (#18795)
We introduced an accidental breaking change a few months ago in 4.1.5 with #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 #18793
1 parent e4c0255 commit ce9b290

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Drop warning from browser build ([#18731](https://github.com/tailwindlabs/tailwindcss/issues/18731))
1313

14+
### Fixed
15+
16+
- Don't transition `visibility` when using `transition` ([#18795](https://github.com/tailwindlabs/tailwindcss/pull/18795))
17+
1418
## [4.1.12] - 2025-08-13
1519

1620
### Fixed

packages/tailwindcss/src/utilities.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22091,7 +22091,7 @@ test('transition', async () => {
2209122091
}
2209222092

2209322093
.transition {
22094-
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, visibility, content-visibility, overlay, pointer-events;
22094+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
2209522095
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
2209622096
transition-duration: var(--tw-duration, var(--default-transition-duration));
2209722097
}
@@ -22153,7 +22153,7 @@ test('transition', async () => {
2215322153
),
2215422154
).toMatchInlineSnapshot(`
2215522155
".transition {
22156-
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, visibility, content-visibility, overlay, pointer-events;
22156+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
2215722157
transition-timing-function: var(--tw-ease, ease);
2215822158
transition-duration: var(--tw-duration, .1s);
2215922159
}

packages/tailwindcss/src/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4504,7 +4504,7 @@ export function createUtilities(theme: Theme) {
45044504

45054505
functionalUtility('transition', {
45064506
defaultValue:
4507-
'color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, visibility, content-visibility, overlay, pointer-events',
4507+
'color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events',
45084508
themeKeys: ['--transition-property'],
45094509
handle: (value) => [
45104510
decl('transition-property', value),

0 commit comments

Comments
 (0)