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

Prevent loading=lazy from being copied from iframe to amp-iframe since invalid (and built-in) #3939

Closed
westonruter opened this issue Dec 16, 2019 · 1 comment · Fixed by #3941
Assignees
Milestone

Comments

@westonruter
Copy link
Member

westonruter commented Dec 16, 2019

Bug Description

When adding an <iframe> with loading=lazy attribute, a validation error is raised because of this loading attribute. The AMP_Iframe_Sanitizer should be just omitting the loading attribute entirely when it has a value of lazy since amp-iframe does lazy-loading by default and so it is redundant.

If the value is anything other than lazy (e.g. eager or auto) then a validation error should still be raised so the user is informed of the failed attempt to lazy-load.

Relates to #3938.

Expected Behaviour

No validation error should be raised when loading=lazy is added to an <iframe>.

Steps to reproduce

  1. Create a Custom HTML block with <iframe loading="lazy" src="https://example.com" width="320" height="640"></iframe>
  2. Save the post.
  3. See the validation error.

Screenshots

image

Additional context

  • WordPress version:
  • Plugin version:
  • Gutenberg plugin version (if applicable):
  • AMP plugin template mode:
  • PHP version:
  • OS:
  • Browser: [e.g. chrome, safari]
  • Device: [e.g. iPhone6]

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

QA testing instructions

  1. Create a Custom HTML block with <iframe loading="lazy" src="https://example.com" width="320" height="640"></iframe>

    1. Save the post.
    2. No validation errors should be reported.
  2. Create a Custom HTML block with <iframe loading="eager" src="https://example.com" width="320" height="640"></iframe>

    1. Save the post.
    2. The following validation error should be reported:

image

Demo

Changelog entry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants