Skip to content

Conversation

@thecrypticace
Copy link
Contributor

Fixes #19345

In v3 the ringColor.DEFAULT option was used as the default color for ring utilities (when it was defined). This currently gets translated as --ring-color but that doesn't work this way in v4. Instead it should translate to --default-ring-color and not --ring-color.

I've also tweaked the upgrade tool to handle this properly as well.

@thecrypticace thecrypticace requested a review from a team as a code owner November 20, 2025 23:46
@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

Walkthrough

This pull request adds support for handling ringColor.DEFAULT in JavaScript-based Tailwind CSS configurations. The changes introduce special-case logic to map ringColor.DEFAULT to the CSS custom property --default-ring-color across multiple layers: the configuration upgrade codemod, the theme application logic, and their corresponding test suites. This enables proper recognition and resolution of default ring color values during configuration processing and runtime theme generation.

Pre-merge checks

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding support for ringColor.DEFAULT in JavaScript configurations.
Description check ✅ Passed The description directly relates to the changeset, explaining the context (v3 vs v4 behavior) and detailing the changes made.
Linked Issues check ✅ Passed The PR comprehensively addresses issue #19345 by updating ringColor.DEFAULT handling to map to --default-ring-color instead of --ring-color across all relevant code paths.
Out of Scope Changes check ✅ Passed All code changes are directly related to handling ringColor.DEFAULT migration and translation, with no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

Copy link

@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: 0

🧹 Nitpick comments (1)
packages/@tailwindcss-upgrade/src/codemods/config/migrate-js-config.ts (1)

240-246: Migration of ringColor.DEFAULT to --default-ring-color looks correct

The upgrade path now emits --default-ring-color for ringColor.DEFAULT and skips the generic keyPathToCssProperty mapping, keeping the generated CSS consistent with the runtime theme behavior and avoiding an incorrect --ring-color variable.

If we add more special-cased theme keys in future, consider centralizing this mapping so apply-config-to-theme and the upgrader can’t drift apart.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 479b725 and 301ef64.

📒 Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • integrations/upgrade/js-config.test.ts (2 hunks)
  • packages/@tailwindcss-upgrade/src/codemods/config/migrate-js-config.ts (1 hunks)
  • packages/tailwindcss/src/compat/apply-config-to-theme.test.ts (2 hunks)
  • packages/tailwindcss/src/compat/apply-config-to-theme.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/@tailwindcss-upgrade/src/codemods/config/migrate-js-config.ts (1)
packages/tailwindcss/src/utils/escape.ts (1)
  • escape (2-73)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Linux / upgrade
  • GitHub Check: Linux / vite
  • GitHub Check: Linux / postcss
  • GitHub Check: Linux
🔇 Additional comments (5)
CHANGELOG.md (1)

18-18: Changelog entry correctly describes the ringColor.DEFAULT fix

The new “Fixed” bullet is accurate, scoped, and links to the correct PR, so the release notes will clearly communicate this behavior change.

packages/tailwindcss/src/compat/apply-config-to-theme.ts (1)

53-63: Special-case for ringColor.DEFAULT--default-ring-color is correct and consistent

Handling ringColor.DEFAULT before the generic keyPathToCssProperty path ensures we no longer emit --ring-color and instead populate --default-ring-color with the right theme options, matching the intended v3-compatible behavior.

packages/tailwindcss/src/compat/apply-config-to-theme.test.ts (1)

60-63: Tests accurately cover the new default ring color behavior

Adding ringColor.DEFAULT to the test config and asserting that --ring-color is unset while --default-ring-color is '#fff' validates the new mapping end-to-end and guards against regressions.

Also applies to: 132-133

integrations/upgrade/js-config.test.ts (2)

37-39: LGTM! Test input properly configured.

The ringColor.DEFAULT configuration correctly sets up the test case for validating the v3 to v4 migration behavior. The test value #c0ffee is clearly identifiable in the output.


197-198: LGTM! Expected output correctly validates the migration.

The test properly verifies that ringColor.DEFAULT migrates to --default-ring-color (not --ring-color), which aligns with the PR objectives. The snapshot-based assertion implicitly confirms that the old --ring-color variable does not appear in the output.

Comment on lines +53 to +63
// ringColor.DEFAULT is a special case that maps to `--default-ring-color`
// as to match the behavior of v3
if (path[0] === 'ringColor' && path[1] === 'DEFAULT') {
designSystem.theme.add(
'--default-ring-color',
'' + value,
ThemeOptions.INLINE | ThemeOptions.REFERENCE | ThemeOptions.DEFAULT,
)

continue
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused why this is handled in isolation here since we had a lot of other DEFAULT special keys that are supported in v4 too via the --default-* pattern, e.g.: --default-ring-width, --default-outline-width, --default-transition-duration. So I'd expect there to a code path a bit more generic to handle all of these variants.

From my quick look it seems that we didn't handle this in apply-config-to-theme at all right now so not sure if this is an oversight or if there's an alternative explanation?

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.

Upgrade tool doesn't migrate ringColor.DEFAULT correctly

3 participants