WordPress.org

Make WordPress Core

Changeset 21317


Ignore:
Timestamp:
07/24/2012 06:01:22 PM (8 years ago)
Author:
ryan
Message:

Add screen reader text to checkboxes in list tables. Props MikeLittle, nacin. see #21325

Location:
trunk/wp-admin/includes
Files:
7 edited

Legend:

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

    r20533 r21317  
    318318
    319319    function column_cb( $comment ) {
    320         if ( $this->user_can )
    321             echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
     320        if ( $this->user_can ) {
     321            echo '<label class="screen-reader-text" for="cb-select-' . $comment->comment_ID . '">' . __( 'Select comment' )
     322                . "</label><input id='cb-select-$comment->comment_ID' type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
     323        }
    322324    }
    323325
  • trunk/wp-admin/includes/class-wp-links-list-table.php

    r19712 r21317  
    130130                switch ( $column_name ) {
    131131                    case 'cb':
    132                         echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'. esc_attr( $link->link_id ) .'" /></th>';
     132                        echo '<th scope="row" class="check-column"><label for="cb-select-' . $link->link_id . '" class="screen-reader-text">' . sprintf( __( 'Select %s' ), $link->link_name )
     133                                . '</label><input type="checkbox" name="linkcheck[]" id="cb-select-' . $link->link_id . '" value="'. esc_attr( $link->link_id ) .'" /></th>';
    133134                        break;
    134135
  • trunk/wp-admin/includes/class-wp-list-table.php

    r20198 r21317  
    664664        else
    665665            $current_order = 'asc';
     666
     667        if ( ! empty( $columns['cb'] ) ) {
     668            static $cb_counter = 1;
     669            $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' )
     670                . '</label><input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
     671            $cb_counter++;
     672        }
    666673
    667674        foreach ( $columns as $column_key => $column_display_name ) {
  • trunk/wp-admin/includes/class-wp-media-list-table.php

    r21162 r21317  
    192192        <th scope="row" class="check-column">
    193193            <?php if ( $user_can_edit ) { ?>
    194                 <input type="checkbox" name="media[]" value="<?php the_ID(); ?>" />
     194                <label for="cb-select-<?php the_ID(); ?>" class="screen-reader-text"><?php echo sprintf( __( 'Select %s' ), $att_title );?></label>
     195                <input type="checkbox" name="media[]" id="cb-select-<?php the_ID(); ?>" value="<?php the_ID(); ?>" />
    195196            <?php } ?>
    196197        </th>
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r21311 r21317  
    493493            case 'cb':
    494494            ?>
    495             <th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
     495            <th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?>
     496            <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title );
     497            ?></label><input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
     498            <?php } ?></th>
    496499            <?php
    497500            break;
  • trunk/wp-admin/includes/class-wp-terms-list-table.php

    r19712 r21317  
    237237
    238238        if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
    239             return '<input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" />';
    240         else
    241             return '&nbsp;';
     239            return '<label for="cb-select-' . $tag->term_id . '" class="screen-reader-text">' . sprintf( __( 'Select %s' ), $tag->name )
     240                . '</label><input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" id="cb-select-' . $tag->term_id . '" />';
     241
     242        return '&nbsp;';
    242243    }
    243244
  • trunk/wp-admin/includes/class-wp-users-list-table.php

    r19712 r21317  
    257257
    258258            // Set up the checkbox ( because the user is editable, otherwise its empty )
    259             $checkbox = "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";
     259            $checkbox = '<label for="cb-select-' . $user_object->ID . '" class="screen-reader-text">' . sprintf( __( 'Select %s' ), $user_object->user_login )
     260                        . "</label><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";
    260261
    261262        } else {
Note: See TracChangeset for help on using the changeset viewer.