Add screen reader text to checkboxes in list tables. Props MikeLittle, nacin. see #21325
git-svn-id: https://develop.svn.wordpress.org/trunk@21317 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a2b93fcf55
commit
c47eef91e0
@ -317,8 +317,10 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
function column_cb( $comment ) {
|
||||
if ( $this->user_can )
|
||||
echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
|
||||
if ( $this->user_can ) {
|
||||
echo '<label class="screen-reader-text" for="cb-select-' . $comment->comment_ID . '">' . __( 'Select comment' )
|
||||
. "</label><input id='cb-select-$comment->comment_ID' type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
|
||||
}
|
||||
}
|
||||
|
||||
function column_comment( $comment ) {
|
||||
|
@ -129,7 +129,8 @@ class WP_Links_List_Table extends WP_List_Table {
|
||||
|
||||
switch ( $column_name ) {
|
||||
case 'cb':
|
||||
echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'. esc_attr( $link->link_id ) .'" /></th>';
|
||||
echo '<th scope="row" class="check-column"><label for="cb-select-' . $link->link_id . '" class="screen-reader-text">' . sprintf( __( 'Select %s' ), $link->link_name )
|
||||
. '</label><input type="checkbox" name="linkcheck[]" id="cb-select-' . $link->link_id . '" value="'. esc_attr( $link->link_id ) .'" /></th>';
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
|
@ -664,6 +664,13 @@ class WP_List_Table {
|
||||
else
|
||||
$current_order = 'asc';
|
||||
|
||||
if ( ! empty( $columns['cb'] ) ) {
|
||||
static $cb_counter = 1;
|
||||
$columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' )
|
||||
. '</label><input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
|
||||
$cb_counter++;
|
||||
}
|
||||
|
||||
foreach ( $columns as $column_key => $column_display_name ) {
|
||||
$class = array( 'manage-column', "column-$column_key" );
|
||||
|
||||
|
@ -191,7 +191,8 @@ foreach ( $columns as $column_name => $column_display_name ) {
|
||||
?>
|
||||
<th scope="row" class="check-column">
|
||||
<?php if ( $user_can_edit ) { ?>
|
||||
<input type="checkbox" name="media[]" value="<?php the_ID(); ?>" />
|
||||
<label for="cb-select-<?php the_ID(); ?>" class="screen-reader-text"><?php echo sprintf( __( 'Select %s' ), $att_title );?></label>
|
||||
<input type="checkbox" name="media[]" id="cb-select-<?php the_ID(); ?>" value="<?php the_ID(); ?>" />
|
||||
<?php } ?>
|
||||
</th>
|
||||
<?php
|
||||
|
@ -492,7 +492,10 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
|
||||
case 'cb':
|
||||
?>
|
||||
<th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
|
||||
<th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?>
|
||||
<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title );
|
||||
?></label><input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
|
||||
<?php } ?></th>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
@ -236,9 +236,10 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||
$default_term = get_option( 'default_' . $taxonomy );
|
||||
|
||||
if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
|
||||
return '<input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" />';
|
||||
else
|
||||
return ' ';
|
||||
return '<label for="cb-select-' . $tag->term_id . '" class="screen-reader-text">' . sprintf( __( 'Select %s' ), $tag->name )
|
||||
. '</label><input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" id="cb-select-' . $tag->term_id . '" />';
|
||||
|
||||
return ' ';
|
||||
}
|
||||
|
||||
function column_name( $tag ) {
|
||||
|
@ -256,7 +256,8 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
$edit .= $this->row_actions( $actions );
|
||||
|
||||
// Set up the checkbox ( because the user is editable, otherwise its empty )
|
||||
$checkbox = "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";
|
||||
$checkbox = '<label for="cb-select-' . $user_object->ID . '" class="screen-reader-text">' . sprintf( __( 'Select %s' ), $user_object->user_login )
|
||||
. "</label><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";
|
||||
|
||||
} else {
|
||||
$edit = '<strong>' . $user_object->user_login . '</strong>';
|
||||
|
Loading…
Reference in New Issue
Block a user