Improve accessibility of nav menu locations form.

A couple of small tweaks to the nav menu locations form that make it friendlier to assistive technology.  These include:
 * labels for selects
 * better context for the "Edit" link.  We hide "edit" from screen readers and instead give them a phrase with context since they may not be able to take advantage of the visual context

Additionally, there are some minor css tweaks to improve the visual alignment of the rows.
We also remove duplicate IDs and use classes instead.

Props afercia.
fixes #31090.


Built from https://develop.svn.wordpress.org/trunk@31272


git-svn-id: http://core.svn.wordpress.org/trunk@31253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2015-01-23 18:18:26 +00:00
parent 04216633b2
commit a4a1273d3a
6 changed files with 28 additions and 20 deletions

View File

@ -101,10 +101,6 @@ ul.add-menu-item-tabs li {
margin-top: 1px; margin-top: 1px;
} }
.menu-edit p {
margin: .3em 0 .6em;
}
.menu-edit #post-body-content h3 { .menu-edit #post-body-content h3 {
margin: 1em 0 10px; margin: 1em 0 10px;
} }
@ -216,8 +212,16 @@ ul.add-menu-item-tabs li {
margin-top: -2px; margin-top: -2px;
} }
.widefat td.menu-location-menus { .widefat .menu-locations tr + tr td {
padding-bottom: 5px; padding-top: 0;
}
.widefat .menu-locations td {
vertical-align: middle;
}
.menu-location-title label {
font-weight: bold;
} }
.menu-location-menus select { .menu-location-menus select {

View File

@ -101,10 +101,6 @@ ul.add-menu-item-tabs li {
margin-top: 1px; margin-top: 1px;
} }
.menu-edit p {
margin: .3em 0 .6em;
}
.menu-edit #post-body-content h3 { .menu-edit #post-body-content h3 {
margin: 1em 0 10px; margin: 1em 0 10px;
} }
@ -216,8 +212,16 @@ ul.add-menu-item-tabs li {
margin-top: -2px; margin-top: -2px;
} }
.widefat td.menu-location-menus { .widefat .menu-locations tr + tr td {
padding-bottom: 5px; padding-top: 0;
}
.widefat .menu-locations td {
vertical-align: middle;
}
.menu-location-title label {
font-weight: bold;
} }
.menu-location-menus select { .menu-location-menus select {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -581,8 +581,8 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
</tfoot>--> </tfoot>-->
<tbody class="menu-locations"> <tbody class="menu-locations">
<?php foreach ( $locations as $_location => $_name ) { ?> <?php foreach ( $locations as $_location => $_name ) { ?>
<tr id="menu-locations-row"> <tr class="menu-locations-row">
<td class="menu-location-title"><strong><?php echo $_name; ?></strong></td> <td class="menu-location-title"><label for="locations-<?php echo $_location; ?>"><?php echo $_name; ?></label></td>
<td class="menu-location-menus"> <td class="menu-location-menus">
<select name="menu-locations[<?php echo $_location; ?>]" id="locations-<?php echo $_location; ?>"> <select name="menu-locations[<?php echo $_location; ?>]" id="locations-<?php echo $_location; ?>">
<option value="0"><?php printf( '&mdash; %s &mdash;', esc_html__( 'Select a Menu' ) ); ?></option> <option value="0"><?php printf( '&mdash; %s &mdash;', esc_html__( 'Select a Menu' ) ); ?></option>
@ -597,7 +597,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<?php if ( isset( $menu_locations[ $_location ] ) && 0 != $menu_locations[ $_location ] ) : ?> <?php if ( isset( $menu_locations[ $_location ] ) && 0 != $menu_locations[ $_location ] ) : ?>
<span class="locations-edit-menu-link"> <span class="locations-edit-menu-link">
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => $menu_locations[$_location] ), admin_url( 'nav-menus.php' ) ) ); ?>"> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => $menu_locations[$_location] ), admin_url( 'nav-menus.php' ) ) ); ?>">
<?php _ex( 'Edit', 'menu' ); ?> <span aria-hidden="true"><?php _ex( 'Edit', 'menu' ); ?></span><span class="screen-reader-text"><?php _e( 'Edit selected menu' ); ?></span>
</a> </a>
</span> </span>
<?php endif; ?> <?php endif; ?>
@ -606,9 +606,9 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<?php _ex( 'Use new menu', 'menu' ); ?> <?php _ex( 'Use new menu', 'menu' ); ?>
</a> </a>
</span> </span>
</div><!-- #locations-row-links --> </div><!-- .locations-row-links -->
</td><!-- .menu-location-menus --> </td><!-- .menu-location-menus -->
</tr><!-- #menu-locations-row --> </tr><!-- .menu-locations-row -->
<?php } // foreach ?> <?php } // foreach ?>
</tbody> </tbody>
</table> </table>

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-alpha-31271'; $wp_version = '4.2-alpha-31272';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.