[wp-trac] [WordPress Trac] #40590: wp_video_shortcode always adds controls="controls"

WordPress Trac noreply at wordpress.org
Sun Feb 25 10:36:19 UTC 2018


#40590: wp_video_shortcode always adds controls="controls"
-------------------------------------------------+-------------------------
 Reporter:  paulschreiber                        |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Media                                |  Review
 Severity:  normal                               |     Version:  4.7.4
 Keywords:  has-patch 2nd-opinion has-unit-      |  Resolution:
  tests                                          |     Focuses:
-------------------------------------------------+-------------------------
Changes (by birgire):

 * keywords:  has-patch 2nd-opinion => has-patch 2nd-opinion has-unit-tests


Comment:

 Here's a suggestion in [attachment:40590-4.diff] that:

 - uses {{{wp_validate_boolean()}}} on the {{{controls}}} attribute of the
 {{{[video]}}} shortcode, similar as with {{{loop}}} and {{{autoplay}}}
 attributes. It can validate inputs like these boolean strings: {{{"true",
 "1", "false", "0" }}}. If it's validated as {{{true}}} then
 {{{controls="controls"}}} is added to the {{{<video>}}} tag, otherwise
 it's not added.
 - sets the {{{controls}}} shortcode's attribute as {{{true}}} by default.
 - updates the existing {{{test_wp_video_shortcode_attributes()}}} test
 method, with two assertions. If more is needed, we could add new test
 methods for various input cases of the {{{controls}}} attribute.

 This patch only covers adding/removing {{{controls="controls"}}} to the
 video tag, via the boolean string {{{controls}}} shortcode's attribute.
 It's another matter how MediaElement.js handles this video tag attribute.
 I did some quick testing and it looks like more is needed to remove the
 controls.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40590#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list