Make WordPress Core


Ignore:
Timestamp:
07/25/2014 12:19:21 AM (12 years ago)
Author:
wonderboymusic
Message:

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

Props joedolson.
Fixes #28867.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r29206 r29294  
    344344         * @since 3.1.0
    345345         * @access protected
    346          */
    347         protected function bulk_actions() {
     346         *
     347         * @param string $which The location of the bulk actions: 'top' or 'bottom'.
     348         */
     349        protected function bulk_actions( $which ) {
    348350                if ( is_null( $this->_actions ) ) {
    349351                        $no_new_actions = $this->_actions = $this->get_bulk_actions();
     
    370372                        return;
    371373
    372                 echo "<select name='action$two'>\n";
     374                echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select Bulk Action' ) . "</label>";
     375                echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
    373376                echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
    374377
     
    639642                        $html_current_page = $current;
    640643                } else {
    641                         $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />",
     644                        $html_current_page_label = "<label for='current-page-selector'>" . __( 'Select Page' ) . "</label>";
     645                        $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' />",
    642646                                esc_attr__( 'Current page' ),
    643647                                $current,
     
    899903
    900904                <div class="alignleft actions bulkactions">
    901                         <?php $this->bulk_actions(); ?>
     905                        <?php $this->bulk_actions( $which ); ?>
    902906                </div>
    903907<?php
Note: See TracChangeset for help on using the changeset viewer.