Adds `<label>`s to current page selector and bulk actions `<select>` field so that screen readers have an explicit label.

Props joedolson.
Fixes #28867.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-07-25 00:20:16 +00:00
parent 0005433983
commit 97fff7e952
3 changed files with 11 additions and 7 deletions

View File

@ -343,8 +343,10 @@ class WP_List_Table {
* *
* @since 3.1.0 * @since 3.1.0
* @access protected * @access protected
*
* @param string $which The location of the bulk actions: 'top' or 'bottom'.
*/ */
protected function bulk_actions() { protected function bulk_actions( $which ) {
if ( is_null( $this->_actions ) ) { if ( is_null( $this->_actions ) ) {
$no_new_actions = $this->_actions = $this->get_bulk_actions(); $no_new_actions = $this->_actions = $this->get_bulk_actions();
/** /**
@ -369,7 +371,8 @@ class WP_List_Table {
if ( empty( $this->_actions ) ) if ( empty( $this->_actions ) )
return; return;
echo "<select name='action$two'>\n"; echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select Bulk Action' ) . "</label>";
echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n"; echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
foreach ( $this->_actions as $name => $title ) { foreach ( $this->_actions as $name => $title ) {
@ -638,7 +641,8 @@ class WP_List_Table {
if ( 'bottom' == $which ) { if ( 'bottom' == $which ) {
$html_current_page = $current; $html_current_page = $current;
} else { } else {
$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />", $html_current_page_label = "<label for='current-page-selector'>" . __( 'Select Page' ) . "</label>";
$html_current_page = $html_current_page_label . sprintf( "<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d' />",
esc_attr__( 'Current page' ), esc_attr__( 'Current page' ),
$current, $current,
strlen( $total_pages ) strlen( $total_pages )
@ -898,7 +902,7 @@ class WP_List_Table {
<div class="tablenav <?php echo esc_attr( $which ); ?>"> <div class="tablenav <?php echo esc_attr( $which ); ?>">
<div class="alignleft actions bulkactions"> <div class="alignleft actions bulkactions">
<?php $this->bulk_actions(); ?> <?php $this->bulk_actions( $which ); ?>
</div> </div>
<?php <?php
$this->extra_tablenav( $which ); $this->extra_tablenav( $which );

View File

@ -298,13 +298,13 @@ class WP_Plugins_List_Table extends WP_List_Table {
return $actions; return $actions;
} }
public function bulk_actions() { public function bulk_actions( $which ) {
global $status; global $status;
if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) if ( in_array( $status, array( 'mustuse', 'dropins' ) ) )
return; return;
parent::bulk_actions(); parent::bulk_actions( $which );
} }
protected function extra_tablenav( $which ) { protected function extra_tablenav( $which ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.0-beta2-20140724'; $wp_version = '4.0-beta2-20140725';
/** /**
* 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.