Skip to content

Media Queries 4 #154

Closed
Closed

Description

@romainmenke

Description

I was working on an updated fallback for @custom-media and was surprised to find that there are subtle and unexpected differences between browsers when it comes to @media.

There are many failing WPT tests across all browsers but some examples :

  • extra parenthese : ((orientation))
  • or support : (orientation) or (orientation)

Rationale

It is not trivial for users to figure out which @media features are supported in all browsers.

Are styles not applied because the query doesn't match or because it is not supported?

Aligning supported features across browsers at the same time will aid in adoption of some the new features.

Specification

https://www.w3.org/TR/mediaqueries-4/

Tests

https://wpt.fyi/results/css/mediaqueries?label=master&label=experimental&aligned

Activity

  1. gsnedders commented on Sep 25, 2022

    @gsnedders
    Member

    In practice, this has significant overlap with #141, as that is one of the most significant parts of MQ4.

  2. added this to the milestone on Sep 25, 2022
  3. moved this to Proposed in Interop 2023on Oct 7, 2022
  4. removed this from the milestone on Oct 7, 2022
  5. romainmenke commented on Nov 9, 2022

    @romainmenke
    Author

    I think it is best to see this mostly separate from #141.
    Media range syntax is the most well known and most popular addition in media queries 4 but in general I think media queries need a bit of extra attention.

    https://wpt.fyi/results/css/mediaqueries?label=master&label=experimental&aligned&view=subtest&q=media

    There aren't that many tests for media queries and no single browser scores really well.
    Only the basic features and usage can be expected to work well in all engines.

  6. gsnedders commented on Nov 9, 2022

    @gsnedders
    Member

    There aren't that many tests for media queries and no single browser scores really well. Only the basic features and usage can be expected to work well in all engines.

    A lot of the Firefox failures at least are down to w3c/csswg-drafts#7595, where it seems like different people interpreted the spec differently. I don't think there's necessarily a large number of discrete bugs here.

    But yeah, there's definitely still more work to be done here above and beyond range syntax. Just, like, it's worthwhile knowing there are both proposals. And that may have implications if one or both are accepted (e.g., one could imagine if both are accepted we just have a singular "Media Queries" focus area).

  7. romainmenke commented on Nov 9, 2022

    @romainmenke
    Author

    one could imagine if both are accepted we just have a singular "Media Queries" focus area

    I would like that :)

    I plan to focus for a while on bits of mediaqueries-4 in PostCSS. Very little has been done in PostCSS in the past. A large factor was the lack of a media query parser and OM.

  8. gsnedders commented on Nov 10, 2022

    @gsnedders
    Member

    I highly doubt we want all of these, but:

    % rg '(@media|\.matchMedia)' css --glob '!mediaqueries' --glob '!css-conditional' --sort path --files-with-matches
    css/CSS2/box-display/containing-block-024.xht
    css/CSS2/box-display/containing-block-025.xht
    css/CSS2/cascade/at-import-009.xht
    css/CSS2/css1/c71-fwd-parsing-002.xht
    css/CSS2/media/media-dependency-001.xht
    css/CSS2/media/media-dependency-002.xht
    css/CSS2/media/media-dependency-006.xht
    css/CSS2/media/media-dependency-007.xht
    css/CSS2/media/media-dependency-009.xht
    css/CSS2/media/media-dependency-010.xht
    css/CSS2/media/media-dependency-011.xht
    css/CSS2/media/media-dependency-012.xht
    css/CSS2/media/media-dependency-013.xht
    css/CSS2/media/media-dependency-014.xht
    css/CSS2/media/media-dependency-015.xht
    css/CSS2/media/media-dependency-016.xht
    css/CSS2/media/media-dependency-017.xht
    css/CSS2/page-box/at-page-rule-001.xht
    css/CSS2/positioning/position-fixed-003.xht
    css/CSS2/positioning/position-fixed-004.xht
    css/CSS2/positioning/position-fixed-005.xht
    css/CSS2/section-index.xht
    css/CSS2/syntax/at-rule-004.xht
    css/CSS2/syntax/at-rule-013.xht
    css/CSS2/syntax/case-sensitive-001.xht
    css/CSS2/syntax/declarations-009.xht
    css/CSS2/syntax/eof-004.xht
    css/CSS2/syntax/import-001.xht
    css/CSS2/syntax/invalid-decl-at-rule-001.xht
    css/CSS2/syntax/invalid-decl-at-rule-002.xht
    css/css-cascade/layer-media-query.html
    css/css-cascade/layer-statement-copy-crash.html
    css/css-color-adjust/rendering/dark-color-scheme/support/prefers-color-scheme-blue-purple.html
    css/css-color-adjust/rendering/dark-color-scheme/support/prefers-color-scheme.svg
    css/css-color-adjust/rendering/dark-color-scheme/svg-as-image-ref.html
    css/css-contain/container-queries/container-inner-at-rules.html
    css/css-contain/container-queries/container-units-media-queries.html
    css/css-flexbox/interactive/flexbox_interactive_break-after-column-item.html
    css/css-flexbox/interactive/flexbox_interactive_break-after-column-lastitem.html
    css/css-flexbox/interactive/flexbox_interactive_break-after-container.html
    css/css-flexbox/interactive/flexbox_interactive_break-after-item.html
    css/css-flexbox/interactive/flexbox_interactive_break-after-line-order.html
    css/css-flexbox/interactive/flexbox_interactive_break-after-line.html
    css/css-flexbox/interactive/flexbox_interactive_break-after-multiline.html
    css/css-flexbox/interactive/flexbox_interactive_break-before-column-firstitem.html
    css/css-flexbox/interactive/flexbox_interactive_break-before-column-item.html
    css/css-flexbox/interactive/flexbox_interactive_break-before-container.html
    css/css-flexbox/interactive/flexbox_interactive_break-before-item.html
    css/css-flexbox/interactive/flexbox_interactive_break-before-multiline.html
    css/css-flexbox/interactive/flexbox_interactive_break-natural.html
    css/css-namespaces/syntax-016.xml
    css/css-nesting/conditional-properties-ref.html
    css/css-nesting/conditional-properties.html
    css/css-nesting/conditional-rules-ref.html
    css/css-nesting/conditional-rules.html
    css/css-nesting/invalid-inner-rules.html
    css/css-nesting/invalidation-004.html
    css/css-nesting/parsing.html
    css/css-nesting/serialize-group-rules-with-decls.tentative.html
    css/css-page/page-rule-declarations-001.html
    css/css-ui/appearance-serialization.html
    css/css-ui/webkit-appearance-serialization.html
    css/css-values/calc-in-media-queries-001.html
    css/css-values/calc-in-media-queries-002.html
    css/css-values/calc-in-media-queries-with-mixed-units.html
    css/css-values/support/mixed-units-01.html
    css/css-values/support/mixed-units-02.html
    css/css-values/support/mixed-units-03.html
    css/css-values/support/mixed-units-04.html
    css/css-values/support/mixed-units-05.html
    css/css-values/support/mixed-units-06.html
    css/css-values/viewport-units-media-queries.html
    css/css-variables/test_variable_legal_values.html
    css/css-writing-modes/test-plan/req-tcu-font.html
    css/cssom/CSSGroupingRule-cssRules.html
    css/cssom/CSSGroupingRule-insertRule.html
    css/cssom/CSSStyleSheet.html
    css/cssom/MediaList.html
    css/cssom/cssom-ruleTypeAndOrder.html
    css/cssom/getComputedStyle-dynamic-subdoc.html
    css/cssom/idlharness.html
    css/cssom/removerule-invalidation-crash.html
    css/cssom/serialize-media-rule.html
    css/cssom-view/MediaQueryList-addListener-removeListener.html
    css/cssom-view/MediaQueryList-change-event-matches-value.html
    css/cssom-view/MediaQueryList-extends-EventTarget-interop.html
    css/cssom-view/MediaQueryList-extends-EventTarget.html
    css/cssom-view/matchMedia-display-none-iframe.html
    css/cssom-view/matchMedia.html
    css/cssom-view/resources/matchMedia.js
    css/printing/existing-transition-in-media-print.tentative.html
    css/printing/transition-in-media-print.tentative.html
    css/selectors/attribute-selectors/attribute-case/cssom.html
    
  9. romainmenke commented on Nov 10, 2022

    @romainmenke
    Author

    Thank you for that list and the command to generate it!

    Hehe, wasn't asking to include all of them for the purpose of interop 2023 :)
    I wanted to make sure that I wasn't misjudging the current test coverage (my perception vs. reality).
    I am going over the specification and adding missing tests in WPT to get a better overview.

  10. foolip commented on Nov 11, 2022

    @foolip
    Member

    Survey results for range media queries, which is part of Media Queries Level 4, have been posted to #141 (comment).

  11. foolip commented on Nov 17, 2022

    @foolip
    Member

    @lilles has helped me review the Chrome failures in https://wpt.fyi/results/css/mediaqueries?label=master&label=experimental&aligned

    We'd like to exclude:

    • viewport-script-dynamic.html has <meta name="viewport" content="width=300"> and can't be tested in desktop browsers.
    • Tests failures related to media query features ‘navigation-controls’, ‘overflow-block’, and ‘update’.

    Additional test review might turn up more things.

  12. romainmenke commented on Nov 17, 2022

    @romainmenke
    Author

    I am also adding more tests like this one : web-platform-tests/wpt#36911

  13. lilles commented on Nov 17, 2022

    @lilles
    Member

    I didn't look closely at the features mentioned above, but after looking a bit closer, nav-controls is introduced in level 5 of the spec. overflow-block/inline and update look quite trivial to implement, but I'm not sure how important they are.

  14. foolip commented on Dec 5, 2022

    @foolip
    Member

    @romainmenke thanks for adding those tests! I've reviewed, merged and also have labeled them. A link to all labeled tests to follow...

  15. added
    accepted
    on Feb 1, 2023
  16. foolip commented on Feb 1, 2023

    @foolip
    Member

    Thank you for proposing Media Queries 4 for inclusion in Interop 2023.

    We are pleased to let you know that this proposal was accepted as the Media Queries 4 focus area. You can follow the progress of this Focus Area on the Interop 2023 dashboard.

    For an overview of our process, see the proposal selection summary. Thank you for contributing to Interop 2023!

    Posted on behalf of the Interop team.

  17. romainmenke commented on Feb 1, 2023

    @romainmenke
    Author

    Really excited about this!
    Thank you @foolip and everyone involved 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedfocus-area-proposal

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions