[css-contain-3][css-mediaqueries-5] Unified custom queries
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
The spec for Media Queries Level 5 currently specifies a way to define custom media properties like e.g. @custom-media --modern (color), (hover); with CSS Containment currently getting shipped beforehand, wouldn't it make sense to rename @custom-media to @custom-query, to create a reusable and unified way for creating custom properties that are including a query?
I mean if I get the idea of the current draft correctly, values inside of @custom-media could also be used inside of @container and @supports as well. But these aren't media, but feature & containment / container or even style queries.
Proposed @custom-query Solution
@custom-query --narrow-size (inline-size > 30em);
@custom-query --full-grid-support (display: grid) and (grid-template-columns: subgrid;);
@custom-query --is-special style(--is-round: true) and style(--is-highlighted: true);
@custom-query --combined-media-query-list (--narow-size), (--is-special);
@media (--narrow-window) {
...
}
@container card (--narrow-window) {
...
}
@container card (--is-special) {
...
}
@container card (--combined-media-query-list ) {
...
}
@supports (--full-grid-support) {
...
}
If from a technical stand point it isn't possible to get a unified solution for queries, this is a proposal for reusable custom-queries for supports & container, e.g. @custom-container fand @custom-supports.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Media Queries Level 5 and CSS Containment specifications, focusing on @custom-media, @container, and @supports. Compare the proposed @custom-query model with those existing rules; done means the Working Group has a settled proposal or disposition for unified custom queries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100