Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#50731 closed defect (bug) (fixed)

Add "loading" as an allowed kses image attribute

Reported by: timothyblynjacobs's profile TimothyBlynJacobs Owned by: whyisjake's profile whyisjake
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.5
Component: Media Keywords: has-patch has-unit-tests has-dev-note
Focuses: Cc:


Now that lazy loading images in Core, I think loading should be added to $allowedposttags for images.

This caused an issue with Twenty Twenty because the theme applies wp_kses_post to the output of get_avatar in its comment section which caused the loading attribute to be removed.

Attachments (1)

50731.diff (1.2 KB) - added by azaozz 4 years ago.

Download all attachments as: .zip

Change History (6)

#1 follow-up: @peterwilsoncc
4 years ago

  • Keywords needs-unit-tests added

This makes sense.

I've added needs tests, adding an image tag as HTML should do as ensuring avatars have a loading attribute is best for the avatar portion of the test suite.

4 years ago

#2 in reply to: ↑ 1 @azaozz
4 years ago

Replying to peterwilsoncc:

You mean something like 50731.diff? Or should it test a "real" gravatar img tag?

#3 @peterwilsoncc
4 years ago

  • Keywords has-patch has-unit-tests commit added; needs-patch needs-unit-tests removed

@azaozz Thanks, that's exactly what I meant. I've modified the keywords accordingly.

#4 @whyisjake
4 years ago

  • Owner set to whyisjake
  • Resolution set to fixed
  • Status changed from new to closed

In 48572:

Media: Add "loading" as an allowed kses image attribute

With loading="lazy" being added to all images in [47554], let's ensure that it passes kses attributes too.

Fixes #50731.
Props TimothyBlynJacobs, peterwilsoncc, azaozz.

#5 @desrosj
4 years ago

  • Keywords has-dev-note added; commit removed

This received a call out in the Miscellaneous Developer Changes in 5.5 dev note:

Note: See TracTickets for help on using tickets.