Automattic / newspack-blocks

Gutenberg blocks for the Newspack project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Post Carousel: Fix AMP validation error

tmmbecker opened this issue · comments

Describe the bug
Newspack Post Carousel block causes AMP validation errors in GSC with this message: Usage of the !important CSS qualifier is not allowed.

To Reproduce
Steps to reproduce the behavior:

  1. Add a Post Carousel block to any page.
  2. Run AMP validation.
  3. View message.

It looks like the AMP tree shaker isn’t able to replace the !important qualifiers used here:

'(min-width: 1168px) ' . ( $attributes['aspectRatio'] / $slides_to_show * 100 ) . '% !important, (min-width: 782px) ' . ( $slides_to_show > 1 ? ( $attributes['aspectRatio'] / 2 * 100 ) . '% !important' : ( $attributes['aspectRatio'] * 100 ) . '% !important' ) . ', ' . ( $attributes['aspectRatio'] * 100 ) . '% !important',

Screenshots
If applicable, add screenshots to help explain your problem.

Expected behavior

Pages would pass AMP validation when using the Post Carousel block.

Edited to add: this has been reported by CalMatters and EastMojo.

Enlace reported as well.

AMP is no longer with us [*]