[wp-trac] [WordPress Trac] #62926: Redundant "for" in nav-menus

WordPress Trac noreply at wordpress.org
Mon Feb 10 21:43:40 UTC 2025


#62926: Redundant "for" in nav-menus
-----------------------------------------+------------------------------
 Reporter:  kkmuffme                     |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Menus                        |     Version:
 Severity:  trivial                      |  Resolution:
 Keywords:  has-patch 2nd-opinion close  |     Focuses:  accessibility
-----------------------------------------+------------------------------
Changes (by sabernhardt):

 * keywords:  has-patch 2nd-opinion => has-patch 2nd-opinion close


Old description:

> /wp-admin/nav-menus.php
>
> {{{
> <label class="bulk-select-button" for="bulk-select-switcher-top">
> <input type="checkbox" id="bulk-select-switcher-top" name="bulk-select-
> switcher-top" class="bulk-select-switcher">
> <span class="bulk-select-button-label">Bulk Select</span>
> </label>
> }}}
>
> The for= is redundant since the input is nested in the label and can be
> removed

New description:

 `/wp-admin/nav-menus.php`

 {{{
 <label class="bulk-select-button" for="bulk-select-switcher-top">
         <input type="checkbox" id="bulk-select-switcher-top" name="bulk-
 select-switcher-top" class="bulk-select-switcher">
         <span class="bulk-select-button-label">Bulk Select</span>
 </label>
 }}}

 The `for=` is redundant since the input is nested in the label and can be
 removed

--

Comment:

 @joedolson already commented about not removing the attributes on a
 [https://core.trac.wordpress.org/ticket/62548#comment:4 similar ticket]:

 > in no circumstances should we elect to remove the `for` attributes so
 that we only use implicit labeling.

 [34991] removed the `for` attributes from `hide-column-tog` checkboxes,
 but it kept them for `editor-expand-toggle` and `wp_welcome_panel-hide`
 checkboxes. Removing the attribute seems to have been unintentional.

 Possibly switching to explicit association:

 - #21603 created the menu item bulk select labels with implicit label
 association (only a few years ago).
 - The entire label area (with a border) is clickable in its current
 design, and the CSS has selectors for this markup.
   {{{
    label.bulk-select-button:hover,
    label.bulk-select-button:active,
    label.bulk-select-button:focus-within {
   }}}
 - Few [https://wpdirectory.net/search/01JKRHESEFCZFNVGC57X6WSXHQ directory
 plugins] target `.bulk-select-button`, but I think any custom styles that
 might conflict could use more generic selectors.

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


More information about the wp-trac mailing list