Skip to content

AMP validator issues warning for @media User Preference features. #40384

Description

@milindmore22

Description

The AMP validator is flagging a warning for a CSS media query using the not (prefers-reduced-motion: reduce) syntax. While this syntax is valid in modern browsers, the AMP validator seems to have stricter parsing rules that cause it to be misinterpreted.

This issue impacts accessibility features, as the styles intended for users without a preference for reduced motion are not being applied correctly in the validated AMP version.

@media not (prefers-reduced-motion: reduce) {
  .wp-block-image amp-img.hide {
    visibility: hidden;
  }
}

Reproduction Steps

  1. Add the problematic CSS code to the <style amp-custom> tag of an AMP page.
  2. Run the page through the official AMP validator (e.g., validator.ampproject.org).
  3. Observe the "malformed media query" warning in the validation results.

You can find warnning on

  1. https://beebom.com/nyt-strands-today-hints-answers-spangram-august-5-2024/amp/
  2. https://wordpress.org/support/topic/gsc-reports-a-warning-for-style-amp-custom/

Relevant Logs

CSS syntax error in tag 'style amp-custom' - malformed media query.

Browser(s) Affected

No response

OS(s) Affected

all

Device(s) Affected

all

AMP Version Affected

2507172035000

Activity

  1. SinghCod3r commented on Aug 25, 2025

    @SinghCod3r

    @milindmore22 , please assign this task to me. I want to work on this project.

  2. milindmore22 commented on Aug 25, 2025

    @milindmore22
    Author

    @SinghCod3r I just reported an issue; I can't assign a task. You can start working on it and create a PR and refer to this issue in the PR description. Here is AMP's official contribution guide.

  3. self-assigned this
    on Aug 25, 2025
  4. erwinmombay commented on Aug 25, 2025

    @erwinmombay
    Member

    thanks for the report. i think it makes sense to fix this and add support to this, but let me talk with the team first.

  5. added theissue type on Sep 3, 2025
  6. youssefbouraoui1 commented on Sep 9, 2025

    @youssefbouraoui1

    Is this issue solved because i cannot find a warning in https://beebom.com/nyt-strands-today-hints-answers-spangram-august-5-2024/amp/

  7. erwinmombay commented on Sep 9, 2025

    @erwinmombay
    Member

    We haven't tackled this issue yet @youssefbouraoui1 , currently in our backlog

  8. dhawalepranav commented on Sep 22, 2025

    @dhawalepranav

    @erwinmombay We are still seeing the AMP validator issue and the affected page in GSC on our end. Could you please look into resolving this at the earliest convenience? TIA!

    Image
  9. dhawalepranav commented on Oct 7, 2025

    @dhawalepranav

    Hi team,
    Gently checking in on the above.

  10. erwinmombay commented on Oct 7, 2025

    @erwinmombay
    Member

    @banaag im going to try and implement this in the following weeks. do you have any thoughts or pushback against this?

  11. dhawalepranav commented on Nov 7, 2025

    @dhawalepranav

    @erwinmombay Gently checking in on the above 🙇🏻

  12. dhawalepranav commented on Nov 28, 2025

    @dhawalepranav

    @erwinmombay Gently following up on this. Can we please expedite the fix/change as early as possible? This is affecting one of our client's website.

  13. dhawalepranav commented on Jan 27, 2026

    @dhawalepranav

    Hi @erwinmombay and @Durvesh-dev,
    Gently checking in know when these changes are expected to be released in the AMP plugin. Thanks in advance.

  14. dhawalepranav commented on Sep 28, 2026

    @dhawalepranav

    Hi @erwinmombay,

    Gently checking in to see when these fixes are expected to be released. We’d really appreciate it if this could be prioritized. Thanks for your support!

  15. dhawalepranav commented on Oct 22, 2026

    @dhawalepranav

    Hi Team

    Gently checking in to see when these fixes are expected to be released. We’d really appreciate it if this could be prioritized. Thanks for your support!

  16. erwinmombay commented on Oct 22, 2026

    @erwinmombay
    Member

    heya @dhawalepranav sorry for the wait. lets get #40454 green and push it through

  17. erwinmombay commented on Oct 22, 2026

    @erwinmombay
    Member

    also would the syntax below work for you?

     @media not all and (prefers-reduced-motion: reduce) { ... }
    
    @media (prefers-reduced-motion: no-preference) { ... }
    
    
  18. dhawalepranav commented on Nov 9, 2026

    @dhawalepranav

    @erwinmombay Yes, the above mentioned syntax works for us. TIA!

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

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions