[wp-meta] [Making WordPress.org] #6002: "for" element on labels failing to allow people to click the label to activate the checkbox

Making WordPress.org noreply at wordpress.org
Tue Jan 4 02:27:50 UTC 2022


#6002: "for" element on labels failing to allow people to click the label to
activate the checkbox
-----------------------------+---------------------
 Reporter:  topher1kenobe    |       Owner:  (none)
     Type:  defect           |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Photo Directory  |  Resolution:  fixed
 Keywords:                   |
-----------------------------+---------------------
Changes (by dd32):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 > despite the HTML being proper

 This is because the HTML is not proper, the `for=` attribute must
 reference the ID of the checkbox, not the name of the checkbox.

 I've updated the code to place the checkbox inside the label instead.
 {{{
 #!diff
 Index: inc/uploads.php
 ===================================================================
 --- inc/uploads.php     (revision 18139)
 +++ inc/uploads.php     (working copy)
 @@ -1,2 +1,2 @@ class Uploads {
  $content .= sprintf(
 -       '<div><input type="checkbox" name="%s" required="required" />
 <label for="%s">%s</label></div>',
 +       '<div><label><input type="checkbox" name="%s" required="required"
 /> %s</label></div>',
 }}}

-- 
Ticket URL: <https://meta.trac.wordpress.org/ticket/6002#comment:1>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list