Skip to content

Commit 6164783

Browse files
Emit --tw-drop-shadow property (#16471)
Fixes #16461 Ensure we also emit `@property --tw-drop-shadow`. ## Test plan ``` <div class="drop-shadow-2xl size-72 bg-white"> <div class="size-48 saturate-100 bg-white"></div> </div> ``` now only drops one shadow (screenshot from Vite playground): <img width="562" alt="Screenshot 2025-02-12 at 16 37 25" src="https://github.com/user-attachments/assets/94eaaf54-6fd5-4d10-9297-9e7523a02602" />
1 parent 53749c3 commit 6164783

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- Show suggestions for fractions in IntelliSense ([#16353](https://github.com/tailwindlabs/tailwindcss/pull/16353))
1919
- Don’t replace `_` in suggested theme keys ([#16433](https://github.com/tailwindlabs/tailwindcss/pull/16433))
2020
- Ensure `--default-outline-width` can be used to change the `outline-width` value of the `outline` utility
21+
- Ensure drop shadow utilities don't inherit unexpectedly ([#16471](https://github.com/tailwindlabs/tailwindcss/pull/16471))
2122

2223
## [4.0.6] - 2025-02-10
2324

packages/tailwindcss/src/utilities.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13407,6 +13407,11 @@ test('filter', async () => {
1340713407
@property --tw-sepia {
1340813408
syntax: "*";
1340913409
inherits: false
13410+
}
13411+
13412+
@property --tw-drop-shadow {
13413+
syntax: "*";
13414+
inherits: false
1341013415
}"
1341113416
`)
1341213417
expect(

packages/tailwindcss/src/utilities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3152,6 +3152,7 @@ export function createUtilities(theme: Theme) {
31523152
property('--tw-opacity'),
31533153
property('--tw-saturate'),
31543154
property('--tw-sepia'),
3155+
property('--tw-drop-shadow'),
31553156
])
31563157
}
31573158

packages/tailwindcss/tests/ui.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,35 @@ test('inset shadow colors', async ({ page }) => {
410410
)
411411
})
412412

413+
test('filter', async ({ page }) => {
414+
let { getPropertyValue } = await render(
415+
page,
416+
html`
417+
<div
418+
id="a"
419+
class="blur-md brightness-50 contrast-50 drop-shadow-md grayscale hue-rotate-180 invert saturate-50 sepia"
420+
>
421+
<div id="b" class="contrast-100"></div>
422+
</div>
423+
`,
424+
)
425+
426+
expect(await getPropertyValue('#a', 'filter')).toEqual(
427+
[
428+
'blur(12px)',
429+
'brightness(0.5)',
430+
'contrast(0.5)',
431+
'grayscale(1)',
432+
'hue-rotate(180deg)',
433+
'invert(1)',
434+
'saturate(0.5)',
435+
'sepia(1)',
436+
'drop-shadow(rgba(0, 0, 0, 0.12) 0px 3px 3px)',
437+
].join(' '),
438+
)
439+
expect(await getPropertyValue('#b', 'filter')).toEqual('contrast(1)')
440+
})
441+
413442
test('outline style is optional', async ({ page }) => {
414443
let { getPropertyValue } = await render(
415444
page,

0 commit comments

Comments
 (0)