mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-24 05:04:25 +00:00
Administration: Set accessible state for list table headers.
Implement `aria-sort` and change icon states to indicate current sort for list tables. Allow screen reader users to get context about the current sort and allow sighted users to know how the table is currently sorted. Props afercia, rianrietveld, joedolson, alexstine, johnjamesjacoby. Fixes #32170. git-svn-id: https://develop.svn.wordpress.org/trunk@55971 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -540,8 +540,8 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
*/
|
||||
protected function get_sortable_columns() {
|
||||
return array(
|
||||
'author' => 'comment_author',
|
||||
'response' => 'comment_post_ID',
|
||||
'author' => array( 'comment_author', false, __( 'Author' ), __( 'Table ordered by Comment Author.' ) ),
|
||||
'response' => array( 'comment_post_ID', false, _x( 'In Response To', 'column name' ), __( 'Table ordered by Post Replied To.' ) ),
|
||||
'date' => 'comment_date',
|
||||
);
|
||||
}
|
||||
@@ -580,6 +580,14 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
|
||||
?>
|
||||
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
|
||||
<?php
|
||||
if ( ! isset( $_GET['orderby'] ) ) {
|
||||
// In the initial view, Comments are ordered by comment's date but there's no column for that.
|
||||
echo '<caption class="screen-reader-text">' . __( 'Ordered by Comment Date, descending.' ) . '</p>';
|
||||
} else {
|
||||
$this->print_table_description();
|
||||
}
|
||||
?>
|
||||
<thead>
|
||||
<tr>
|
||||
<?php $this->print_column_headers(); ?>
|
||||
|
||||
Reference in New Issue
Block a user