Skip to content

Conversation

@tfeijo
Copy link

@tfeijo tfeijo commented Jan 15, 2026

Summary

Wrap the first media condition in parentheses to create valid @custom-media syntax for --viewportRange-narrowLandscape.

Before:

@custom-media --viewportRange-narrowLandscape (max-width: calc(63.25rem - 0.02px) and (max-height: calc(34rem - 0.02px)) and (orientation: landscape));

After:

@custom-media --viewportRange-narrowLandscape ((max-width: calc(63.25rem - 0.02px)) and (max-height: calc(34rem - 0.02px)) and (orientation: landscape));

This fixes CSS optimization warnings in tools like Tailwind CSS v4:

Found 1 warning while optimizing generated CSS:
│ @custom-media --viewportRange-narrowLandscape (max-width: calc(63.25rem - 0.02px) and ...
┆                                                                                  ^-- Unexpected token Ident("and")

Fixes #1288

Test plan

  • npm run build completes successfully
  • Generated CSS in dist/css/functional/size/viewport.css has correct syntax

Wrap the first media condition in parentheses to create valid
@Custom-Media syntax. This fixes CSS optimization warnings in
tools like Tailwind CSS v4.

Fixes primer#1288
@tfeijo tfeijo requested review from a team as code owners January 15, 2026 14:38
@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: 0cf3ec3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/primitives Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

Invalid @custom-media syntax in viewport.css causes CSS optimization warnings

1 participant