Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Media queries #1673

Merged
merged 25 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f6e2785
Add prefers- media queries
jamesnw Aug 23, 2024
f58d9a3
Update spec
jamesnw Aug 23, 2024
872e3da
Add Interaction media queries
jamesnw Aug 27, 2024
690f2ce
Merge branch 'prefer-queries' of https://github.com/oddbird/web-featu…
jamesnw Aug 27, 2024
6a48ca7
Rename new media query features
jamesnw Aug 27, 2024
e139452
Add media-queries group
jamesnw Aug 27, 2024
78c1c6a
Add resolution media query
jamesnw Aug 27, 2024
ce9ff25
Add media queries base
jamesnw Aug 27, 2024
ec9906e
Add more media features, change query to feature where applicable
jamesnw Aug 27, 2024
368d22e
Add color-gamut
jamesnw Aug 27, 2024
0249768
Add groups
jamesnw Aug 27, 2024
71694ee
Merge branch 'main' into media-queries
jamesnw Aug 28, 2024
b5a9d5a
Merge branch 'main' of github.com:web-platform-dx/web-features into m…
jamesnw Sep 3, 2024
a2b00f4
Address review
jamesnw Sep 3, 2024
263fcb4
Merge branch 'main' of github.com:web-platform-dx/web-features into m…
jamesnw Sep 12, 2024
f7c3c5c
Merge branch 'main' of github.com:web-platform-dx/web-features into m…
jamesnw Sep 16, 2024
ba1662e
Rename media features and files
jamesnw Sep 16, 2024
bfdd479
Remove dsstore
jamesnw Sep 16, 2024
0c150de
Remove color gamut values
jamesnw Sep 16, 2024
ff4f9d5
Merge branch 'main' into media-queries
jamesnw Sep 17, 2024
8e8aba6
Add more media queries
jamesnw Sep 17, 2024
280587b
Address review
jamesnw Sep 18, 2024
7453fff
Remove resolution media query
jamesnw Sep 18, 2024
586f86d
Review
jamesnw Sep 18, 2024
0414415
Merge branch 'main' of github.com:web-platform-dx/web-features into m…
jamesnw Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions features/media-queries-color-gamut.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: color-gamut media feature
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applies to other files too: we don't explain here the difference between media query, media type, and media feature. I don't know that we need to do this, we're not a documentation website like MDN. But here, for example, the ID is media-queries-color-gamut while the name is color-gamut media feature.

Perhaps we should only use the term media-feature for media feature things, and then add a short mention in the main media-queries feature like "Media queries are composed of an optional media type such as screen or print, and one or more mandatory media features, such as prefers-reduced-animations".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled on the naming for this. I think media feature is perhaps more spec language than developer language, but I think your addition to media-queries makes sense.

For the id, I'm realizing that I was essentially adding the group to the file name, with the side benefit of being able to see them together in the file list. Would you recommend media-feature-color-gamut, color-gamut-media-feature, or just color-gamut?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a good clarification to the media-queries feature, and still I would consider naming the individual features e.g. color-gamut media query as a more common way for developers to talk about these features.

I don't have a strong sense on IDs, but looking at what's there, I think we're past the point of naming things in a way that is nicely sorted. Folders by group would be more helpful on that front.

description: The `color-gamut` media feature sets styles based on the colors a device can display. Values are `srgb` if the device can display at least sRGB, `p3` if the device can display at least Display P3, and `rec2020` if the device can display at least REC. 2020.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if color-gamut is a field that evolves quickly, but if it is, we might want to drop the "Values are ..." sentence, to avoid having to maintain this to always be complete.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on conversations with spec authors and implementors, this should be a rather stable list. There are privacy issues with going more granular, and it's unlikely that gamuts larger than rec2020 will be needed soon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the color() function now supports a number of additional spaces with distinct gamuts, I do wonder if there will be a push for consistency?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll remove the values.

spec: https://drafts.csswg.org/mediaqueries-5/#color-gamut
group: media-queries
compat_features:
- css.at-rules.media.color-gamut
16 changes: 16 additions & 0 deletions features/media-queries-color-gamut.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated from: media-queries-color-gamut.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: low
baseline_low_date: 2023-02-14
support:
chrome: "58"
chrome_android: "58"
edge: "79"
firefox: "110"
firefox_android: "110"
safari: "10"
safari_ios: "10"
compat_features:
- css.at-rules.media.color-gamut
7 changes: 7 additions & 0 deletions features/media-queries-display-mode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: display-mode media feature
description: The `display-mode` CSS media feature sets styles based on whether the user's browser is in `fullscreen`, `standalone`, `minimal-ui,` `browser`, or `picture-in-picture` mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"based on whether the user's browser" is a bit incorrect here. For example, standalone and minimal-ui only really make sense when the site was installed as a PWA on the device, in which case the user doesn't really consider the site as running in a "browser" any longer.

How about:

Suggested change
description: The `display-mode` CSS media feature sets styles based on whether the user's browser is in `fullscreen`, `standalone`, `minimal-ui,` `browser`, or `picture-in-picture` mode.
description: The `display-mode` CSS media feature sets styles based on whether the web page is in `fullscreen`, `standalone`, `minimal-ui,` `browser`, or `picture-in-picture` mode. For example, an installed Progressive Web App can be displayed in a standalone window by setting `"display": "standalone"` in its web app manifest file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point on "web page". I removed the example because it was over the 300 character limit, and it seemed more about a PWA feature than about the media query itself, but am not opposed to an example here.

spec: https://drafts.csswg.org/mediaqueries-5/#display-modes
group: media-queries
compat_features:
- css.at-rules.media.display-mode
- css.at-rules.media.display-mode.picture-in-picture
25 changes: 25 additions & 0 deletions features/media-queries-display-mode.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated from: media-queries-display-mode.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
chrome: "123"
edge: "123"
compat_features:
# baseline: false
# support:
# chrome: "42"
# chrome_android: "42"
# edge: "79"
# firefox: "47"
# safari: "13"
# safari_ios: "12.2"
- css.at-rules.media.display-mode

# ⬇️ Same status as overall feature ⬇️
# baseline: false
# support:
# chrome: "123"
# edge: "123"
- css.at-rules.media.display-mode.picture-in-picture
6 changes: 6 additions & 0 deletions features/media-queries-dynamic-range.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: dynamic-range media feature
description: The `dynamic-range` CSS media feature sets styles based on whether a device can display at least `standard` range colors or at least `high` range colors. Non-visual devices will match neither.
spec: https://drafts.csswg.org/mediaqueries-5/#dynamic-range
group: media-queries
compat_features:
- css.at-rules.media.dynamic-range
16 changes: 16 additions & 0 deletions features/media-queries-dynamic-range.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated from: media-queries-dynamic-range.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: low
baseline_low_date: 2022-05-03
support:
chrome: "98"
chrome_android: "98"
edge: "98"
firefox: "100"
firefox_android: "100"
safari: "13.1"
safari_ios: "13.4"
compat_features:
- css.at-rules.media.dynamic-range
11 changes: 11 additions & 0 deletions features/media-queries-interaction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Interaction media queries
description: The interaction CSS media queries set styles based on a user's ability to hover using `hover` or `any-hover` or use a pointer using `pointer` and `any-pointer`. For example, a smartphone would match `@media (hover:none) and (pointer:coarse)`.
spec: https://drafts.csswg.org/mediaqueries-5/#mf-interaction
caniuse: css-media-interaction
status:
compute_from: css.at-rules.media.any-pointer
compat_features:
- css.at-rules.media.hover
- css.at-rules.media.any-hover
- css.at-rules.media.any-pointer
- css.at-rules.media.pointer
68 changes: 68 additions & 0 deletions features/media-queries-interaction.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Generated from: media-queries-interaction.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: high
baseline_low_date: 2018-12-11
baseline_high_date: 2021-06-11
support:
chrome: "41"
chrome_android: "41"
edge: "12"
firefox: "64"
firefox_android: "64"
safari: "9"
safari_ios: "9"
compat_features:
# baseline: high
# baseline_low_date: 2018-12-11
# baseline_high_date: 2021-06-11
# support:
# chrome: "38"
# chrome_android: "50"
# edge: "12"
# firefox: "64"
# firefox_android: "64"
# safari: "9"
# safari_ios: "9"
- css.at-rules.media.hover

# ⬇️ Same status as overall feature ⬇️
# baseline: high
# baseline_low_date: 2018-12-11
# baseline_high_date: 2021-06-11
# support:
# chrome: "41"
# chrome_android: "41"
# edge: "12"
# firefox: "64"
# firefox_android: "64"
# safari: "9"
# safari_ios: "9"
- css.at-rules.media.any-pointer

# baseline: high
# baseline_low_date: 2018-12-11
# baseline_high_date: 2021-06-11
# support:
# chrome: "41"
# chrome_android: "41"
# edge: "16"
# firefox: "64"
# firefox_android: "64"
# safari: "9"
# safari_ios: "9"
- css.at-rules.media.any-hover

# baseline: high
# baseline_low_date: 2018-12-11
# baseline_high_date: 2021-06-11
# support:
# chrome: "41"
# chrome_android: "50"
# edge: "12"
# firefox: "64"
# firefox_android: "64"
# safari: "9"
# safari_ios: "9"
- css.at-rules.media.pointer
6 changes: 6 additions & 0 deletions features/media-queries-inverted-colors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: inverted-colors media feature
description: The `inverted-colors` CSS media feature sets styles based on whether the user has inverted all colors.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description screams for a "Such as when ...", in order to make it easier to understand when/why/how a user might do that. Is this an OS setting similar to high contrast modes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it's an OS accessibility option.

spec: https://drafts.csswg.org/mediaqueries-5/#inverted
group: media-queries
compat_features:
- css.at-rules.media.inverted-colors
10 changes: 10 additions & 0 deletions features/media-queries-inverted-colors.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Generated from: media-queries-inverted-colors.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
safari: "9.1"
safari_ios: "10"
compat_features:
- css.at-rules.media.inverted-colors
9 changes: 9 additions & 0 deletions features/media-queries-overflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Overflow media features
description: The `overflow-block` and `overflow-inline` CSS media features set styles based on how a user's device will show content that is larger than the screen. Options are `none` (for instance, a billboard), `scroll` (for instance, a laptop), or `paged` (for instance, a printer).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: The `overflow-block` and `overflow-inline` CSS media features set styles based on how a user's device will show content that is larger than the screen. Options are `none` (for instance, a billboard), `scroll` (for instance, a laptop), or `paged` (for instance, a printer).
description: The `overflow-block` and `overflow-inline` CSS media features set styles based on the way a device displays content that's larger than its container element. For example, a laptop lets users scroll to reveal content, while a printer displays the overflowing content on additional pages.

Since this can be used for printers, I don't think saying user's device helps here. Also removing "screen" for the same reason.

I'm not sure about the second sentence with the different values. The billboard example confuses me a bit. When would that happen? So I tried to rephrase above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was confused by "container element" due to the overloaded term "element", so I used MDN's language around the initial containing block, "viewport or page area".

I'm ok not having an example for none here, but the idea is, if there is overflowing content on a webpage displayed on a billboard, there is no way a viewer can access the overflowed content.

spec:
- https://drafts.csswg.org/mediaqueries-5/#mf-overflow-block
- https://drafts.csswg.org/mediaqueries-5/#mf-overflow-inline
group: media-queries
compat_features:
- css.at-rules.media.overflow-block
- css.at-rules.media.overflow-inline
17 changes: 17 additions & 0 deletions features/media-queries-overflow.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated from: media-queries-overflow.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: low
baseline_low_date: 2023-09-18
support:
chrome: "113"
chrome_android: "113"
edge: "113"
firefox: "66"
firefox_android: "66"
safari: "17"
safari_ios: "17"
compat_features:
- css.at-rules.media.overflow-block
- css.at-rules.media.overflow-inline
6 changes: 6 additions & 0 deletions features/media-queries-prefers-contrast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: prefers-contrast
description: The `prefers-contrast` CSS media feature detects the requested contrast, more or less.
spec: https://drafts.csswg.org/mediaqueries-5/#prefers-contrast
group: media-queries
compat_features:
- css.at-rules.media.prefers-contrast
16 changes: 16 additions & 0 deletions features/media-queries-prefers-contrast.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated from: media-queries-prefers-contrast.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: low
baseline_low_date: 2022-05-31
support:
chrome: "96"
chrome_android: "96"
edge: "96"
firefox: "101"
firefox_android: "101"
safari: "14.1"
safari_ios: "14.5"
compat_features:
- css.at-rules.media.prefers-contrast
6 changes: 6 additions & 0 deletions features/media-queries-prefers-reduced-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: prefers-reduced-data
description: The `prefers-reduced-data` CSS media feature detects whether the user has a preference for using less internet traffic.
spec: https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-data
group: media-queries
compat_features:
- css.at-rules.media.prefers-reduced-data
8 changes: 8 additions & 0 deletions features/media-queries-prefers-reduced-data.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Generated from: media-queries-prefers-reduced-data.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support: {}
compat_features:
- css.at-rules.media.prefers-reduced-data
12 changes: 12 additions & 0 deletions features/media-queries-prefers-reduced-motion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: prefers-reduced-motion
description: The `prefers-reduced-motion` CSS media feature detects whether the user requested less non-essential animation.
spec:
- https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-motion
- https://wicg.github.io/user-preference-media-features-headers/#sec-ch-prefers-reduced-motion
caniuse: prefers-reduced-motion
group: media-queries
status:
compute_from: css.at-rules.media.prefers-reduced-motion
compat_features:
- css.at-rules.media.prefers-reduced-motion
- http.headers.Sec-CH-Prefers-Reduced-Motion
36 changes: 36 additions & 0 deletions features/media-queries-prefers-reduced-motion.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated from: media-queries-prefers-reduced-motion.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: high
baseline_low_date: 2020-01-15
baseline_high_date: 2022-07-15
support:
chrome: "74"
chrome_android: "74"
edge: "79"
firefox: "63"
firefox_android: "64"
safari: "10.1"
safari_ios: "10.3"
compat_features:
# ⬇️ Same status as overall feature ⬇️
# baseline: high
# baseline_low_date: 2020-01-15
# baseline_high_date: 2022-07-15
# support:
# chrome: "74"
# chrome_android: "74"
# edge: "79"
# firefox: "63"
# firefox_android: "64"
# safari: "10.1"
# safari_ios: "10.3"
- css.at-rules.media.prefers-reduced-motion

# baseline: false
# support:
# chrome: "108"
# chrome_android: "108"
# edge: "108"
- http.headers.Sec-CH-Prefers-Reduced-Motion
9 changes: 9 additions & 0 deletions features/media-queries-prefers-reduced-transparency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: prefers-reduced-transparency
description: The `prefers-reduced-transparency` CSS media feature detects whether the user requested less transparent effects, which can improve contrast and readability.
spec:
- https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-transparency
- https://wicg.github.io/user-preference-media-features-headers/#sec-ch-prefers-reduced-transparency
group: media-queries
compat_features:
- css.at-rules.media.prefers-reduced-transparency
- http.headers.Sec-CH-Prefers-Reduced-Transparency
24 changes: 24 additions & 0 deletions features/media-queries-prefers-reduced-transparency.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated from: media-queries-prefers-reduced-transparency.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
chrome: "119"
chrome_android: "119"
edge: "119"
compat_features:
# baseline: false
# support:
# chrome: "118"
# chrome_android: "118"
# edge: "118"
- css.at-rules.media.prefers-reduced-transparency

# ⬇️ Same status as overall feature ⬇️
# baseline: false
# support:
# chrome: "119"
# chrome_android: "119"
# edge: "119"
- http.headers.Sec-CH-Prefers-Reduced-Transparency
11 changes: 11 additions & 0 deletions features/media-queries-resolution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: resolution media feature
description: The `resolution` CSS media feature sets styles based on the pixel density, or how many pixels a device uses to display a single CSS pixel.
spec: https://drafts.csswg.org/mediaqueries-5/#resolution
caniuse: css-media-resolution
compat_features:
- css.at-rules.media.resolution
- css.types.resolution
- css.types.resolution.dpcm
- css.types.resolution.dpi
- css.types.resolution.dppx
- css.types.resolution.x
53 changes: 53 additions & 0 deletions features/media-queries-resolution.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated from: media-queries-resolution.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
chrome: "68"
chrome_android: "68"
edge: "79"
firefox: "62"
firefox_android: "62"
compat_features:
# baseline: low
# baseline_low_date: 2022-09-12
# support:
# chrome: "29"
# chrome_android: "29"
# edge: "12"
# firefox: "8"
# firefox_android: "8"
# safari: "16"
# safari_ios: "16"
- css.at-rules.media.resolution

# baseline: false
# support:
# chrome: "29"
# chrome_android: "29"
# edge: "12"
# firefox: "8"
# firefox_android: "8"
- css.types.resolution
- css.types.resolution.dpcm
- css.types.resolution.dpi

# baseline: false
# support:
# chrome: "29"
# chrome_android: "29"
# edge: "12"
# firefox: "16"
# firefox_android: "16"
- css.types.resolution.dppx

# ⬇️ Same status as overall feature ⬇️
# baseline: false
# support:
# chrome: "68"
# chrome_android: "68"
# edge: "79"
# firefox: "62"
# firefox_android: "62"
- css.types.resolution.x
Loading