You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Don't generate invalid CSS for *-inherit colors with an opacity modifier - #20679
#17647 made shadow-inherit, inset-shadow-inherit, text-shadow-inherit and drop-shadow-inherit set the color to inherit, and the first three return nothing when they get an opacity modifier, because inherit can't go inside color-mix(). drop-shadow-inherit/50 still generates it:
the drop-shadow color branch does have an inherit case, but it checks the value returned by resolveThemeColor, which has already applied the modifier. so with /50 the value is color-mix(in oklab, inherit 50%, transparent) and the check never matches.
the fix returns early for inherit with a modifier before resolving the color, the same if (candidate.modifier) return the other three utilities use. drop-shadow-inherit without a modifier is unchanged.
Test plan
added drop-shadow-inherit/50 and drop-shadow-inherit/[0.5] to the list of drop-shadow candidates that must generate nothing in utilities.test.ts. on main the test fails with the css above; with the fix it passes
vitest run src/utilities.test.ts src/intellisense.test.ts in packages/tailwindcss: 421 passed
prettier --check on the changed files and pnpm changelog check pass
The guard now lives in resolveThemeColor, taken from #20718, so inherit with an opacity modifier generates nothing in all color utilities (e.g. bg-inherit/50, ring-inherit/50 or from-inherit/50), not only in drop-shadow. The early return in the drop-shadow utility is gone, because the shared guard covers it. The tests now also cover bg-inherit/50 and bg-inherit/[0.5], and the changelog entry covers all inherit colors.
resolveThemeColor now rejects inherit candidates with opacity modifiers. Tests cover named and arbitrary opacity modifiers for background and drop-shadow candidates expected to produce no CSS. A changelog entry describes the fix.
Merge Risk: Low · up to 0e2eb
Named inherit colors with opacity modifiers now correctly produce no CSS. Arbitrary inherit values with a modifier can still generate invalid CSS, and autocomplete may still suggest modifier forms that produce nothing. Both are low-impact; fix them or accept them before merging.
Pre-merge checks: 4
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Title check
The title names the main change: invalid CSS for *-inherit colors with an opacity modifier is no longer generated. The changeset adds a guard in resolveThemeColor for inherit with a modifier and upd…
Description check
The description explains the problem: shadow-inherit utilities and drop-shadow-inherit with an opacity modifier generate invalid color-mix() output with inherit. It describes the fix, the test changes…
Full details: Title check
Explanation
The title names the main change: invalid CSS for *-inherit colors with an opacity modifier is no longer generated. The changeset adds a guard in resolveThemeColor for inherit with a modifier and updates tests and the changelog, so the title matches the changeset. The title is slightly narrower than the final scope, which now covers all color utilities, but it is not misleading.
Full details: Description check
Explanation
The description explains the problem: shadow-inherit utilities and drop-shadow-inherit with an opacity modifier generate invalid color-mix() output with inherit. It describes the fix, the test changes, the verification steps, and the combined scope with PR #20718. It is related to the changeset.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Exclude invalid inherit opacity completions. · utilities.ts:4766
packages/tailwindcss/src/utilities.ts:4766 Minor · Functional Correctness · Quick win
Exclude invalid inherit opacity completions.
getClassList advertises drop-shadow-inherit/50 even when the color guard makes it generate no CSS. Separate inherit from the modifier-bearing color suggestions, including theme-derived values. Preserve numeric modifier suggestions when --drop-shadow-inherit defines a valid shadow size.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: a929b742-5554-4854-923c-bc085ed0452e
Commits
Reviewing files that changed from the base of the PR and between 9b2c925 and 09aed7a.
Files selected for processing: 3
.changelog/drop-shadow-inherit-modifier.md
packages/tailwindcss/src/utilities.test.ts
packages/tailwindcss/src/utilities.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
on the completion note from coderabbit: shadow, inset-shadow and text-shadow list -inherit with the same opacity modifiers, and #17647 left those as they are. keeping this pr to the generated css; filtering inherit/* out of the suggestions for all four would fit better in its own change.
RobinMalfait
changed the title
Don't generate invalid CSS for drop-shadow-inherit with an opacity modifier
Don't generate invalid CSS for *-inherit colors with an opacity modifier
Nov 16, 2026
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4b42b84d-17c1-4099-865f-b557c526f80a
Commits
Reviewing files that changed from the base of the PR and between e34b1be and 0e2eb94.
Files selected for processing: 3
.changelog/inherit-color-opacity-modifier.md
packages/tailwindcss/src/utilities.test.ts
packages/tailwindcss/src/utilities.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
…ifier
`inherit` is a CSS-wide keyword, so it can't go inside `color-mix()`.
Utilities like `bg-inherit/50` generated
`color-mix(in oklab, inherit 50%, transparent)`, which the browser
drops. Return `null` from `resolveThemeColor` for `inherit` with a
modifier, so all color utilities generate nothing, like
`shadow-inherit/50` already does.
Taken from tailwindlabs#20718.
Co-authored-by: sudeepgowda55 <ssudeepgowda55@gmail.com>
…overs
`resolveThemeColor` returns `null` for `inherit` with a modifier now, so
the early return in the drop-shadow utility never runs. The tests for
`drop-shadow-inherit/50` and `drop-shadow-inherit/[0.5]` still pass.
Move its explanation to the shared guard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#17647 made
shadow-inherit,inset-shadow-inherit,text-shadow-inheritanddrop-shadow-inheritset the color toinherit, and the first three return nothing when they get an opacity modifier, becauseinheritcan't go insidecolor-mix().drop-shadow-inherit/50still generates it:the drop-shadow color branch does have an
inheritcase, but it checks the value returned byresolveThemeColor, which has already applied the modifier. so with/50the value iscolor-mix(in oklab, inherit 50%, transparent)and the check never matches.the fix returns early for
inheritwith a modifier before resolving the color, the sameif (candidate.modifier) returnthe other three utilities use.drop-shadow-inheritwithout a modifier is unchanged.Test plan
drop-shadow-inherit/50anddrop-shadow-inherit/[0.5]to the list of drop-shadow candidates that must generate nothing inutilities.test.ts. onmainthe test fails with the css above; with the fix it passesvitest run src/utilities.test.ts src/intellisense.test.tsinpackages/tailwindcss: 421 passedprettier --checkon the changed files andpnpm changelog checkpassCombined with #20718
The guard now lives in
resolveThemeColor, taken from #20718, soinheritwith an opacity modifier generates nothing in all color utilities (e.g.bg-inherit/50,ring-inherit/50orfrom-inherit/50), not only indrop-shadow. The early return in the drop-shadow utility is gone, because the shared guard covers it. The tests now also coverbg-inherit/50andbg-inherit/[0.5], and the changelog entry covers allinheritcolors.Sent by an AI assistant on behalf of @RobinMalfait.