[wp-trac] [WordPress Trac] #32495: WP Admin bar multi-level menu accessibility

WordPress Trac noreply at wordpress.org
Mon May 30 21:01:22 UTC 2016

#32495: WP Admin bar multi-level menu accessibility
 Reporter:  joedolson     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  high          |   Milestone:  4.6
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  accessibility, administration
Changes (by afercia):

 * keywords:  has-patch => needs-patch
 * milestone:  Future Release => 4.6


 Looking back at this, I'd propose first of all to allow a proper use of
 the `tabindex` attribute. For accessibility, the only important tabindex
 values to set on the empty menu items (the ones rendered with a `<div>`
 element) are `0` or `-1`. By the way in `_render_item()` these two lines
 don't allow to use '0' to make an item focusable:

 $tabindex = isset( $node->meta['tabindex'] ) ? (int)
 $node->meta['tabindex'] : '';
 $aria_attributes = $tabindex ? 'tabindex="' . $tabindex . '"' : '';
 So say I've set on my menu item meta a `tabindex => '0'` then it is set
 and casted to integer. In the following line is converted to boolean to be
 evaluated and it is false so no luck. I can't make my div focusable.
 I'd propose to change this in order to ''only'' allow `0` and `-1`. Any
 other value shouldn't be allowed.

 This way, diligent plugin authors could build keyboard accessible multi-
 level menus. The change would be simple enough to allow further
 improvements and I don't see backcompat concerns.

Ticket URL: <https://core.trac.wordpress.org/ticket/32495#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list