[wp-trac] [WordPress Trac] #62548: Redundant "for" in wp-admin dashboard
WordPress Trac
noreply at wordpress.org
Mon Nov 25 19:16:50 UTC 2024
#62548: Redundant "for" in wp-admin dashboard
----------------------------+------------------------------
Reporter: kkmuffme | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: trivial | Resolution:
Keywords: has-patch | Focuses: accessibility
----------------------------+------------------------------
Changes (by sabernhardt):
* focuses: => accessibility
Old description:
> {{{
> <label for="dashboard_right_now-hide">
> <input class="hide-postbox-tog" name="dashboard_right_now-hide"
> type="checkbox" id="dashboard_right_now-hide"
> value="dashboard_right_now"/>At a Glance
> </label>
> }}}
>
> The for= is redundant and can be removed, since the input is wrapped in
> the label
> There are a couple other ones there with the same issue
New description:
{{{
<label for="dashboard_right_now-hide">
<input class="hide-postbox-tog" name="dashboard_right_now-hide"
type="checkbox" id="dashboard_right_now-hide"
value="dashboard_right_now"/>At a Glance
</label>
}}}
The `for=` is redundant and can be removed, since the input is wrapped in
the label
There are a couple other ones there with the same issue
--
Comment:
As @afercia noted in ticket:47141#comment:1, the
[https://github.com/WordPress/wpcs-
docs/commit/2568ca56640ba5f85c09e77e4d8fca05362cae57#diff-
3b5a733f79ac6eef3de9603c7e077fcb5886fd4a681d2042084c9c54ea192c79R88
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62548#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list