WordPress.org

Make WordPress Core

Opened 3 weeks ago

Closed 3 weeks ago

Last modified 11 days ago

#50731 closed defect (bug) (fixed)

Add "loading" as an allowed kses image attribute

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

Description

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 3 weeks ago.

Download all attachments as: .zip

Change History (6)

#1 follow-up: @peterwilsoncc
3 weeks 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.

@azaozz
3 weeks ago

#2 in reply to: ↑ 1 @azaozz
3 weeks ago

Replying to peterwilsoncc:

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

#3 @peterwilsoncc
3 weeks 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
3 weeks 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
11 days ago

  • Keywords has-dev-note added; commit removed

This received a call out in the Miscellaneous Developer Changes in 5.5 dev note: https://make.wordpress.org/core/2020/07/29/miscellaneous-developer-focused-changes-in-wordpress-5-5/.

Note: See TracTickets for help on using tickets.