Skip to content

fix(compat): map maxWidth to max-width namespace in v4 migration#19653

Open
NssGourav wants to merge 3 commits intotailwindlabs:mainfrom
NssGourav:fix-max-width-mapping
Open

fix(compat): map maxWidth to max-width namespace in v4 migration#19653
NssGourav wants to merge 3 commits intotailwindlabs:mainfrom
NssGourav:fix-max-width-mapping

Conversation

@NssGourav
Copy link

@NssGourav NssGourav commented Feb 9, 2026

Summary

In Tailwind CSS v4, the migration logic for v3 configurations incorrectly maps the maxWidth theme key to the
--container-* CSS variable namespace. This causes clashes with container query variables and breaks the primary max-w-* utility design.

This PR updates OLD_TO_NEW_NAMESPACE to correctly map maxWidth to max-width.

Fixes #19555

Test Plan

Verified by updating existing core compatibility tests.

Execution command:

pnpm vitest packages/tailwindcss/src/compat/apply-config-to-theme.test.ts --run

@NssGourav NssGourav requested a review from a team as a code owner February 9, 2026 11:53
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: aed966e7-ae88-4656-be26-0d617e755435

📥 Commits

Reviewing files that changed from the base of the PR and between 2670a42 and f43279c.

📒 Files selected for processing (1)
  • packages/tailwindcss/src/compat/apply-config-to-theme.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/tailwindcss/src/compat/apply-config-to-theme.ts

Walkthrough

The pull request changes the CSS property namespace mapping in apply-config-to-theme: the OLD_TO_NEW_NAMESPACE mapping now maps the maxWidth theme key to the max-width namespace instead of container. A test in apply-config-to-theme.test.ts is updated to expect the resolved value from the --max-width CSS property variable for the 9xs key.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: mapping maxWidth to the max-width namespace in v4 migration, which aligns with the primary changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug (incorrect mapping to container namespace), the fix (mapping to max-width), and providing test verification details.
Linked Issues check ✅ Passed The PR successfully addresses issue #19555 by mapping maxWidth to the max-width namespace instead of container, preventing clashes with container query variables and preserving intended semantics after v3-to-v4 migration.
Out of Scope Changes check ✅ Passed All changes are scoped to the maxWidth namespace mapping fix: updates to OLD_TO_NEW_NAMESPACE and corresponding test expectation, with no unrelated modifications.

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

📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

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

Tip

CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.

Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present.

@NssGourav
Copy link
Author

@RobinMalfait can you please review this pr and let me know anything to change

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 (3 -> 4) migrates maxWidth configuration to container vars

1 participant