Commit 40a76e3
authored
Closes #17194.
This reverts commit d6d913e.
The initial fix does breaks older versions of Chrome (where text won't
render with a color for the placeholder at all anymore) and the usage of
the _relative colors_ features also means it'll require a much newer
version of Safari/Firefox/Chrome to work correctly. The implementation
was also wrong as it always set alpha to the specific percent instead of
applying it additively (note that this can be fixed with `calc(alpha *
opacity)` though).
Instead we decided to fix this by adding a `@supports` query to
Preflight that only targets browsers that aren't affected by the crash.
We currently use the following workaround:
```css
/*
Set the default placeholder color to a semi-transparent version of the current text color in browsers that do not
crash when using `color-mix(…)` with `currentColor`. (#17194)
*/
@supports (not (-webkit-appearance: -apple-pay-button)) /* Not Safari */ or
(contain-intrinsic-size: 1px) /* Safari 17+ */ {
::placeholder {
color: color-mix(in oklab, currentColor 50%, transparent);
}
}
```
## Test plan
When testing the `color-mix(currentColor)` vs `oklab(from currentColor
…)` we created the following support matrix. I'm extending it with _our
fix_ which is the fix ended up using:
| Browser | Version | `color-mix(… currentColor …)` | `oklab(from
currentColor …)` | `@supports { color-mix(…) }` |
| ------- | ------- | ----------------------------- |
---------------------------- | ------- |
| Chrome | 111 | ❌ | ❌ | ❌ |
| Chrome | 116 | ✅ | ❌ | ✅ |
| Chrome | 131+ | ✅ | ✅ | ✅ |
| Safari | 16.4 | 💥 | ❌ | ❌ |
| Safari | 16.6+ | ✅ | ❌ | ❌ |
| Safari | 18+ | ✅ | ✅ | ✅ |
| Firefox | 128 | ✅ | ❌ | ✅ |
| Firefox | 133 | ✅ | ✅ | ✅ |
Note that on Safari 16, this change makes it so that the browser does
not crash yet it still won't work either. That's because now the browser
will fall back to the default placeholder color instead. We used the
following play to test the fix: https://play.tailwindcss.com/RF1RYbZLKY
1 parent 3f313b4 commit 40a76e3
File tree
8 files changed
+61
-48
lines changed- packages
- @tailwindcss-postcss/src/__snapshots__
- tailwindcss
- src
- __snapshots__
- compat
8 files changed
+61
-48
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
165 | 170 | | |
166 | 171 | | |
167 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
| 279 | + | |
281 | 280 | | |
282 | 281 | | |
283 | 282 | | |
284 | | - | |
285 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
286 | 296 | | |
287 | 297 | | |
288 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
| |||
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
| 391 | + | |
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
533 | | - | |
| 533 | + | |
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
675 | | - | |
| 675 | + | |
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
| |||
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
817 | | - | |
| 817 | + | |
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
| |||
956 | 956 | | |
957 | 957 | | |
958 | 958 | | |
959 | | - | |
| 959 | + | |
960 | 960 | | |
961 | 961 | | |
962 | 962 | | |
| |||
1098 | 1098 | | |
1099 | 1099 | | |
1100 | 1100 | | |
1101 | | - | |
| 1101 | + | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | 1104 | | |
| |||
1240 | 1240 | | |
1241 | 1241 | | |
1242 | 1242 | | |
1243 | | - | |
| 1243 | + | |
1244 | 1244 | | |
1245 | 1245 | | |
1246 | 1246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3860 | 3860 | | |
3861 | 3861 | | |
3862 | 3862 | | |
3863 | | - | |
| 3863 | + | |
3864 | 3864 | | |
3865 | 3865 | | |
3866 | 3866 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8058 | 8058 | | |
8059 | 8059 | | |
8060 | 8060 | | |
8061 | | - | |
| 8061 | + | |
8062 | 8062 | | |
8063 | 8063 | | |
8064 | 8064 | | |
| |||
8173 | 8173 | | |
8174 | 8174 | | |
8175 | 8175 | | |
8176 | | - | |
| 8176 | + | |
8177 | 8177 | | |
8178 | 8178 | | |
8179 | 8179 | | |
| |||
8286 | 8286 | | |
8287 | 8287 | | |
8288 | 8288 | | |
8289 | | - | |
| 8289 | + | |
8290 | 8290 | | |
8291 | 8291 | | |
8292 | 8292 | | |
| |||
10248 | 10248 | | |
10249 | 10249 | | |
10250 | 10250 | | |
10251 | | - | |
| 10251 | + | |
10252 | 10252 | | |
10253 | 10253 | | |
10254 | 10254 | | |
10255 | | - | |
| 10255 | + | |
10256 | 10256 | | |
10257 | 10257 | | |
10258 | 10258 | | |
| |||
10770 | 10770 | | |
10771 | 10771 | | |
10772 | 10772 | | |
10773 | | - | |
| 10773 | + | |
10774 | 10774 | | |
10775 | 10775 | | |
10776 | 10776 | | |
10777 | | - | |
| 10777 | + | |
10778 | 10778 | | |
10779 | 10779 | | |
10780 | 10780 | | |
| |||
10868 | 10868 | | |
10869 | 10869 | | |
10870 | 10870 | | |
10871 | | - | |
| 10871 | + | |
10872 | 10872 | | |
10873 | 10873 | | |
10874 | 10874 | | |
| |||
11094 | 11094 | | |
11095 | 11095 | | |
11096 | 11096 | | |
11097 | | - | |
| 11097 | + | |
11098 | 11098 | | |
11099 | 11099 | | |
11100 | 11100 | | |
| |||
11316 | 11316 | | |
11317 | 11317 | | |
11318 | 11318 | | |
11319 | | - | |
| 11319 | + | |
11320 | 11320 | | |
11321 | 11321 | | |
11322 | 11322 | | |
| |||
11843 | 11843 | | |
11844 | 11844 | | |
11845 | 11845 | | |
11846 | | - | |
| 11846 | + | |
11847 | 11847 | | |
11848 | 11848 | | |
11849 | 11849 | | |
| |||
11980 | 11980 | | |
11981 | 11981 | | |
11982 | 11982 | | |
11983 | | - | |
| 11983 | + | |
11984 | 11984 | | |
11985 | 11985 | | |
11986 | 11986 | | |
| |||
12956 | 12956 | | |
12957 | 12957 | | |
12958 | 12958 | | |
12959 | | - | |
| 12959 | + | |
12960 | 12960 | | |
12961 | 12961 | | |
12962 | 12962 | | |
| |||
13105 | 13105 | | |
13106 | 13106 | | |
13107 | 13107 | | |
13108 | | - | |
13109 | | - | |
13110 | | - | |
| 13108 | + | |
| 13109 | + | |
| 13110 | + | |
13111 | 13111 | | |
13112 | 13112 | | |
13113 | 13113 | | |
| |||
14810 | 14810 | | |
14811 | 14811 | | |
14812 | 14812 | | |
14813 | | - | |
| 14813 | + | |
14814 | 14814 | | |
14815 | 14815 | | |
14816 | 14816 | | |
| |||
15260 | 15260 | | |
15261 | 15261 | | |
15262 | 15262 | | |
15263 | | - | |
| 15263 | + | |
15264 | 15264 | | |
15265 | 15265 | | |
15266 | 15266 | | |
| |||
15429 | 15429 | | |
15430 | 15430 | | |
15431 | 15431 | | |
15432 | | - | |
| 15432 | + | |
15433 | 15433 | | |
15434 | 15434 | | |
15435 | 15435 | | |
| |||
15651 | 15651 | | |
15652 | 15652 | | |
15653 | 15653 | | |
15654 | | - | |
| 15654 | + | |
15655 | 15655 | | |
15656 | 15656 | | |
15657 | 15657 | | |
| |||
15889 | 15889 | | |
15890 | 15890 | | |
15891 | 15891 | | |
15892 | | - | |
| 15892 | + | |
15893 | 15893 | | |
15894 | 15894 | | |
15895 | 15895 | | |
| |||
16228 | 16228 | | |
16229 | 16229 | | |
16230 | 16230 | | |
16231 | | - | |
| 16231 | + | |
16232 | 16232 | | |
16233 | 16233 | | |
16234 | 16234 | | |
| |||
16472 | 16472 | | |
16473 | 16473 | | |
16474 | 16474 | | |
16475 | | - | |
| 16475 | + | |
16476 | 16476 | | |
16477 | 16477 | | |
16478 | 16478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | 139 | | |
147 | 140 | | |
148 | 141 | | |
| |||
0 commit comments