[wp-trac] [WordPress Trac] #39952: Category Dropdown Widget: required spacing issue on attachments template

WordPress Trac noreply at wordpress.org
Wed Mar 1 16:26:06 UTC 2017


#39952: Category Dropdown Widget: required spacing issue on attachments template
-------------------------------+------------------------------
 Reporter:  tribalNerd         |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  General            |     Version:  4.7.2
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by subrataemfluence):

 * keywords:   => reporter-feedback


Comment:

 Would you mind telling how to reproduce the issue? An example code would
 be handy.

 Replying to [ticket:39952 tribalNerd]:
 > This issue only happens on the attachments.php template, all other
 primary templates don't appear to have the issue.
 >
 > When using the category widget as a dropdown, the select statement looks
 like: <selectname='cat' rather than <select name='cat'
 >
 > The file, category-template.php output statement is:
 >
 > {{{#!php
 > <?php
 > $output = "<select $required name='$name' id='$id' class='$class'
 $tab_index_attribute>\n";
 > }}}
 >
 >
 > Removing $required corrects the issue.
 >
 > Setting required to true also corrects the issue.
 >
 > {{{#!php
 > <?php
 > function categories_dropdown($args) {
 >     $args['required'] = true;
 >     return $args;
 > }
 > add_filter( 'widget_categories_dropdown_args', 'categories_dropdown' );
 > }}}
 >
 >
 > Which returns:
 >
 > {{{
 > <select required="" name="cat" id="cat" class="postform">
 > }}}
 >
 > While this does correct the issue, the required="" isn't correct either,
 it should be: required without the =""
 >
 > https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
 >
 > It should also have aria-required="true" for Safari.

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


More information about the wp-trac mailing list