Make WordPress Core

Changes between Initial Version and Version 3 of Ticket #62548


Ignore:
Timestamp:
11/25/2024 07:16:50 PM (21 months ago)
Author:
sabernhardt
Comment:

As @afercia noted in ticket:47141#comment:1, the accessibility coding standards in 2018 said that the labels should not combine both methods.

Existing code uses a mixture of explicitly and implicitly labeled fields, but all new code must use an explicitly associated <label> element (using for/id attributes and not wrapping the form control).

[34991] removed the for attribute in the implicitly associated hide-column-tog checkbox labels with list tables, but other screen options still have the for attribute:

  • the hide-postbox-tog checkboxes on the Dashboard
  • wp_welcome_panel-hide on the Dashboard
  • editor-expand-toggle in the Classic Editor

Removing the for attributes from these implicitly labeled checkboxes would be simple. If switching to explicit association, the input/label pairs should still have a wrapper span to make sure they stay together when they appear on multiple lines.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #62548

    • Property Keywords has-patch added
    • Property Focuses accessibility added
  • Ticket #62548 – Description

    initial v3  
    22{{{
    33<label for="dashboard_right_now-hide">
    4                                                                                                 <input class="hide-postbox-tog" name="dashboard_right_now-hide" type="checkbox" id="dashboard_right_now-hide" value="dashboard_right_now"/>At a Glance
    5                                                                                         </label>
     4        <input class="hide-postbox-tog" name="dashboard_right_now-hide" type="checkbox" id="dashboard_right_now-hide" value="dashboard_right_now"/>At a Glance
     5</label>
    66}}}
    77
    8 The for= is redundant and can be removed, since the input is wrapped in the label
     8The `for=` is redundant and can be removed, since the input is wrapped in the label
    99There are a couple other ones there with the same issue