WordPress.org

Make WordPress Core

Opened 8 weeks ago

Closed 7 weeks ago

Last modified 7 weeks ago

#50167 closed defect (bug) (fixed)

Relax kses rules to allow setting playsinline attributes in Video elements.

Reported by: youknowriad Owned by: peterwilsoncc
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.3
Component: Formatting Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

the playsinline attribute is a recent HTML attribute that is very important for mobile devices to allow playing (and auto-playing) videos inline.

The block editor allows setting that attribute for a long time now in the video block but it went unnoticed that this attribute was stripped https://github.com/WordPress/gutenberg/pull/14500

In this PR https://github.com/WordPress/gutenberg/pull/22346 we're also adding that attribute to the Cover block to fix video backgrounds on mobile.

An extra php filter is added to "override" the limitation for the cover block and that code needs to be removed once the Kses rules are relaxed.

Attachments (2)

50167.diff (2.8 KB) - added by peterwilsoncc 7 weeks ago.
50167.2.diff (2.8 KB) - added by peterwilsoncc 7 weeks ago.

Download all attachments as: .zip

Change History (10)

#1 @SergeyBiryukov
8 weeks ago

  • Component changed from Editor to Formatting

#2 @peterwilsoncc
8 weeks ago

  • Keywords needs-patch needs-unit-tests added

Yep, happy if this goes in to the allowed attributes of the video element.

While video support is expanded is there any other attributes that you think are likely to need support in Gutenberg?

#3 @youknowriad
8 weeks ago

Thanks, @peterwilsoncc I tried asking around and it doesn't seem like we need another attribute right now.

This ticket was mentioned in Slack in #core-editor by peterwilsoncc. View the logs.


7 weeks ago

@peterwilsoncc
7 weeks ago

#6 @peterwilsoncc
7 weeks ago

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
  • Owner set to peterwilsoncc
  • Status changed from new to assigned

In 50167.2.diff:

  • Adds support for the attribute
  • Adds unit tests for video element so I could test the attribute.

#7 @peterwilsoncc
7 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 47837:

KSES: Support the video element's playsinline attribute.

Allow users without the unfiltered_html capability to use the playsinline attribute when embedding videos.

Additionally this adds unit tests for passing the video element through kses.

Fixes #50167. See #29826.

#8 @youknowriad
7 weeks ago

Thanks for handling this ticket @peterwilsoncc

Note: See TracTickets for help on using tickets.