Skip to content

Use --placeholder-color instead of --background-color for placeholder-* utilities#19843

Merged
RobinMalfait merged 2 commits intomainfrom
fix/issue-19838
Mar 23, 2026
Merged

Use --placeholder-color instead of --background-color for placeholder-* utilities#19843
RobinMalfait merged 2 commits intomainfrom
fix/issue-19838

Conversation

@RobinMalfait
Copy link
Copy Markdown
Member

@RobinMalfait RobinMalfait commented Mar 23, 2026

This PR fixes an issue where placeholder-* utilities were reading values from --background-color instead of --placeholder-color. In Tailwind CSS v3, we read from placeholderColor which is why we should use --placeholder-color here as well.

{ values: flattenColorPalette(theme('placeholderColor')), type: ['color', 'any'] }

That said, this is technically a breaking change in case somebody relies on --background-color for placeholder values. But since this is text related, and most people will rely on the default --color values instead, I think it's safe to change this as-is.

In the unlikely event that somebody does rely on this, then we have 2 options:

  1. Guide them to make use of --placeholder-color instead (preferred solution)
  2. Re-add --background-color after the --placeholder-color (band-aid solution, but might be worth it who knows)

Fixes: #19838

Test plan

  1. Existing tests still pass
  2. Verified in the Tailwind CSS v3 codebase that we did read from placeholderColor which in turn reads from color by default. Which is equivalent to --placeholder-color and --color in Tailwind CSS v4.

@RobinMalfait RobinMalfait requested a review from a team as a code owner March 23, 2026 14:51
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Walkthrough

The placeholder color utility in the Tailwind CSS utilities configuration was updated to read from the correct CSS custom property. The theme lookup keys were changed from checking --background-color and --color to checking --placeholder-color and --color respectively. This aligns the utility's color resolution with the intended placeholder-specific theming mechanism. The change was documented in the CHANGELOG under the Fixed section.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely describes the primary change: updating placeholder utilities to use --placeholder-color instead of --background-color.
Description check ✅ Passed The description clearly explains the issue being fixed, why the change is necessary, acknowledges the breaking change implications, and documents testing performed.
Linked Issues check ✅ Passed The PR changes placeholder color utility's theme lookup from --background-color to --placeholder-color [#19843], directly addressing the reported issue in #19838 that placeholders should use --placeholder-color.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to updating placeholder utility theme lookup keys and documenting the change in CHANGELOG; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CHANGELOG.md`:
- Line 25: Update the changelog entry for the placeholder utilities change to
include a short migration hint: mention that `placeholder-*` utilities now read
from `--placeholder-color` (not `--background-color`), advise users to switch
their custom properties to `--placeholder-color` (or add a fallback CSS variable
mapping if they must keep `--background-color`), and optionally note expected
behavior if `--background-color` fallback is later reintroduced; reference the
`placeholder-*` utilities and the variables `--placeholder-color` and
`--background-color` (and PR `#19843`) in the revised line so upgraders aren’t
surprised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bcd43b1a-bcaa-43c8-b4da-1ed774c5564f

📥 Commits

Reviewing files that changed from the base of the PR and between 6ec8b89 and 8ad515b.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • packages/tailwindcss/src/utilities.ts

- Canonicalization: collapse `scroll-p{t,b}-*` into `scroll-py-*`, `scroll-p{l,r}-*` into `scroll-px-*`, and `scroll-p{t,r,b,l}-*` into `scroll-p-*` ([#19842](https://github.com/tailwindlabs/tailwindcss/pull/19842))
- Canonicalization: collapse `overflow-{x,y}-*` into `overflow-*` ([#19842](https://github.com/tailwindlabs/tailwindcss/pull/19842))
- Canonicalization: collapse `overscroll-{x,y}-*` into `overscroll-*` ([#19842](https://github.com/tailwindlabs/tailwindcss/pull/19842))
- Read from `--placeholder-color` instead of `--background-color` for `placeholder-*` utilities ([#19843](https://github.com/tailwindlabs/tailwindcss/pull/19843))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Clarify migration impact in this changelog entry.

This line describes a behavior change that can break setups relying on --background-color; please add a short migration hint (use --placeholder-color, or mention fallback behavior if reintroduced) so upgraders aren’t surprised.

Suggested wording
-- Read from `--placeholder-color` instead of `--background-color` for `placeholder-*` utilities ([`#19843`](https://github.com/tailwindlabs/tailwindcss/pull/19843))
+- Read from `--placeholder-color` instead of `--background-color` for `placeholder-*` utilities; if you relied on the old behavior, migrate placeholder tokens to `--placeholder-color` ([`#19843`](https://github.com/tailwindlabs/tailwindcss/pull/19843))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Read from `--placeholder-color` instead of `--background-color` for `placeholder-*` utilities ([#19843](https://github.com/tailwindlabs/tailwindcss/pull/19843))
- Read from `--placeholder-color` instead of `--background-color` for `placeholder-*` utilities; if you relied on the old behavior, migrate placeholder tokens to `--placeholder-color` ([`#19843`](https://github.com/tailwindlabs/tailwindcss/pull/19843))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CHANGELOG.md` at line 25, Update the changelog entry for the placeholder
utilities change to include a short migration hint: mention that `placeholder-*`
utilities now read from `--placeholder-color` (not `--background-color`), advise
users to switch their custom properties to `--placeholder-color` (or add a
fallback CSS variable mapping if they must keep `--background-color`), and
optionally note expected behavior if `--background-color` fallback is later
reintroduced; reference the `placeholder-*` utilities and the variables
`--placeholder-color` and `--background-color` (and PR `#19843`) in the revised
line so upgraders aren’t surprised.

@RobinMalfait RobinMalfait merged commit 2c1ef9e into main Mar 23, 2026
9 checks passed
@RobinMalfait RobinMalfait deleted the fix/issue-19838 branch March 23, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

placeholder mapping to --background-color

1 participant