Problem/Motivation

Drupal core added the loading="lazy" attribute to images by default as of 9.1.0. The attribute is persisted in the AMP output and is not valid AMP.

This is also causing the test suite to fail against Drupal 9.2.x.

Steps to reproduce

  1. Setup a content type and display mode for AMP with an image field using AMP Image Formatter.
  2. View the post in AMP.
  3. View source.

Expected result

Image is rendered as valid <amp-img> tag.

Actual result

Image is rendered with an invalid loading="lazy"

The test suite is also catching these failures.

Proposed resolution

Flag the loading attribute as disabled in the relevant AMP field formatters.

Remaining tasks

Merge request it up.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork amp-3231183

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

m4olivei created an issue. See original summary.

m4olivei’s picture

Issue summary: View changes

m4olivei’s picture

Assigned: m4olivei » Unassigned
Status: Active » Patch (to be ported)

Yay! Green!

  • m4olivei committed e92ab26 on 8.x-3.x
    Issue #3231183 by m4olivei: Account for Drupal core adding loading="lazy...
m4olivei’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

nelo_drup’s picture

How is the status of the patch?