Make WordPress Core


Ignore:
Timestamp:
11/04/2016 04:01:24 PM (9 years ago)
Author:
jorbin
Message:

Administration: Ensure collapse menu is usable with a keyboard

Currently, the "Collapse menu" item is not focusable and keyboard users can't collapse/expand the admin menu. This aims to fix it so that screen readers no longer announce it as a clickable but it remains unfocusable and thus unusable. So it's now a button.

Quoting joedolson at WordCamp Chicago 2014:
"If it's supposed to act like a button, it should be a button."

Also includes a grunt:precommit run that picked up some postcss changes to src/wp-includes/css/customize-preview.css

Fixes #29958.
Props ajercia, ipm-frommen for an iterative patch, valendesigns for an iterative patch, GaryJ for feedback, joedolson for feedback, helen for feedback

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/menu-header.php

    r37488 r39141  
    235235    }
    236236
    237     echo '<li id="collapse-menu" class="hide-if-no-js"><div id="collapse-button"><div></div></div>';
    238     echo '<span>' . esc_html__( 'Collapse menu' ) . '</span>';
    239     echo '</li>';
     237    echo '<li id="collapse-menu" class="hide-if-no-js">' .
     238        '<button type="button" id="collapse-button" aria-label="' . esc_attr__( 'Collapse Main menu' ) . '" aria-expanded="true">' .
     239        '<span class="collapse-button-icon" aria-hidden="true"></span>' .
     240        '<span class="collapse-button-label">' . __( 'Collapse menu' ) . '</span>' .
     241        '</button></li>';
    240242}
    241243
Note: See TracChangeset for help on using the changeset viewer.