Fix invalid media query (not(hover)) -> (hover: none)#228
Closed
BurtReynolds wants to merge 1 commit into
Closed
Conversation
|
@jackmorgansplunk is attempting to deploy a commit to the jdan's projects Team on Vercel. A member of the Team first needs to authorize it. |
`@media (not(hover))` is not valid CSS. The `not` keyword in a media query must be followed by whitespace per Media Queries Level 4, so `not(hover)` parses as a function and is rejected. PostCSS (used by this repo's build) tolerates it, but stricter tools do not, so the published file can't be consumed in practice: - Dart Sass (Next.js, Vite, etc.) throws "Expected whitespace", breaking `@include meta.load-css(...)` scoping (jdan#223) - Lightning CSS reports InvalidMediaQuery, preventing import (jdan#218) - The W3C validator rejects it (jdan#218) `(hover: none)` expresses the same intent (target devices whose primary input cannot hover) without the `not` keyword, and parses cleanly in PostCSS, Dart Sass, and Lightning CSS. Fixes jdan#218, jdan#223
2a430bb to
1ed8f5d
Compare
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.
@media (not(hover))is not valid CSS. Thenotkeyword in a media query must be followed by whitespace per Media Queries Level 4, sonot(hover)parses as a function and is rejected.PostCSS (used by this repo's build) tolerates it, but stricter tools do not, so the published file can't be consumed in practice:
@include meta.load-css(...)scoping (98.css breaks with Sass: missing space in @media (not(hover)) #223)(hover: none)expresses the same intent (target devices whose primary input cannot hover) without thenotkeyword, and parses cleanly in PostCSS, Dart Sass, and Lightning CSS.Fixes #218, #223