Making WordPress.org

Opened 2 years ago

Closed 2 years ago

#6002 closed defect (bug) (fixed)

"for" element on labels failing to allow people to click the label to activate the checkbox

Reported by: topher1kenobe's profile topher1kenobe Owned by:
Milestone: Priority: normal
Component: Photo Directory Keywords:
Cc:

Description

When I click on a label on the submission form, I expect it to activate the checkbox, but it doesn't, despite the HTML being proper. Firefox 95 on MacOS 11.6

Attachments (1)

CleanShot 2021-12-27 at 14.16.59@2x.png (47.1 KB) - added by topher1kenobe 2 years ago.

Download all attachments as: .zip

Change History (2)

#1 @dd32
2 years ago

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

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.

  • inc/uploads.php

    class Uploads { 
    11$content .= sprintf(
    2         '<div><input type="checkbox" name="%s" required="required" /> <label for="%s">%s</label></div>',
     2        '<div><label><input type="checkbox" name="%s" required="required" /> %s</label></div>',
Note: See TracTickets for help on using tickets.