Repository navigation
[system] Keep the unit of container query sizes - #49669
Merged
ZeeshanTamboli merged 3 commits intoNov 12, 2026
Merged
Conversation
`breakpoints.up()` appended the theme unit to every value that is not a breakpoint key, so a size that already had a unit got a second one. The container query shorthand goes through it, so `@40em` and `@40rem/sidebar` in `sx` produced `min-width:40empx` and `min-width:40rempx`, which browsers ignore. A string with its own unit is now used as is. Numbers, numeric strings and breakpoint keys still get the theme unit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploy previewBundle size
PerformanceNo regressions in 32 benchmarks · ran 2m 06s · details Check out the code infra dashboard for more information about this PR. |
ZeeshanTamboli
approved these changes
Nov 12, 2026
ZeeshanTamboli
left a comment
Member
There was a problem hiding this comment.
Looks good, thanks. There's one separate issue this PR doesn't touch: the TypeScript type up: (key: Breakpoint | number) doesn't accept '500px'. So the documented up('500px') example still fails type-checking. Widening that type would change the API, so it belongs in a follow-up if anyone wants it.
ZeeshanTamboli
enabled auto-merge (squash)
November 12, 2026 12:21
Contributor
|
Cherry-pick PRs will be created targeting branches: v9.x |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The container query shorthand drops rules whose size has a unit. With a theme from
createTheme():Browsers ignore
40empx, so these styles never apply. The container queries page uses@40emand@20emin its "sorted correctly" example, and the error for an invalid shorthand suggests@40rem/sidebar.The shorthand calls
theme.containerQueries(name).up(size), andbreakpoints.up()appends the theme unit to any value that is not a breakpoint key. Without acontainerQuerieson the theme, the fallback inbreakpoints.tsalready leaves such a size alone and gives@container (min-width:40em).This changes
up()to use a string that has its own unit as is. Numbers, numeric strings and breakpoint keys still get the theme unit, so@600and@smdon't change.down()andbetween()are unchanged: they subtract the step from the value, which needs a number or a key.I also updated the caveat on the docs page that says
@500pxwon't render correctly. With this change it gives the same query as@500.Added tests in
createBreakpoints.test.jsandcssContainerQueries.test.ts. Both fail onmaster.I used Claude Code to write this change.