[wp-trac] [WordPress Trac] #31909: wp_dropdown_categories() select field cannot accept HTML 'required'

WordPress Trac noreply at wordpress.org
Tue May 17 14:21:44 UTC 2016


#31909: wp_dropdown_categories() select field cannot accept HTML 'required'
----------------------------------------+-----------------------
 Reporter:  wzislam                     |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  4.6
Component:  Taxonomy                    |     Version:  4.1.1
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:  template
----------------------------------------+-----------------------

Comment (by pcarvalho):

 Hi everyone!

 this is my first patch to wp, so let me know there's something wrong.


 i've followed @boonebgorges suggestions and:

 * added @since 4.6.0 Added required attribute

 * updated the documentation for this field

 * added the unit test function to Tests_Category with the following
 results:

  [x] test get all category ids
  [x] test get category by slug
  [x] test  make cat compat
  [x] test get cat name
  [x] test get cat ID
  [x] test get category by path
  [x] test wp dropdown categories value field should default to term id
  **[x] test wp dropdown categories value field should contain required**
  [x] test wp dropdown categories value field term id
  [x] test wp dropdown categories value field slug
  [x] test wp dropdown categories value field should fall back on term id
 when an invalid value is provided
  [x] test wp dropdown categories selected should respect custom value
 field
  [x] test wp dropdown categories show option all should be selected if no
 selected value is explicitly passed and value field does not have string
 values
  [x] test wp dropdown categories show option all should be selected if
 selected value of 0 string is explicitly passed and value field does not
 have string values


 == Other attributes

 there's other allowed attributes, namely;

 * **disabled** : ''Specifies that the element represents a disabled
 control''
 * **multiple** : ''indicates that its select element represents a control
 for selecting zero or more options from a list of options.''
 * **size**     : ''The number of options to show to the user.''
 * **form**     : ''The value of the id attribute on the form with which to
 associate the element.''
 * **autofocus** : ''Specifies that the element represents a control to
 which a UA is meant to give focus as soon as the document is loaded.''


 https://www.w3.org/TR/html-markup/select.html

 (html5) https://dev.w3.org/html5/spec-author-view/the-select-element.html
 #the-select-element

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


More information about the wp-trac mailing list