mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-18 19:44: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:
@@ -760,12 +760,28 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_sortable_columns() {
|
||||
return array(
|
||||
'title' => 'title',
|
||||
'parent' => 'parent',
|
||||
'comments' => 'comment_count',
|
||||
'date' => array( 'date', true ),
|
||||
);
|
||||
|
||||
$post_type = $this->screen->post_type;
|
||||
|
||||
if ( 'page' === $post_type ) {
|
||||
$title_orderby_text = isset( $_GET['orderby'] ) ? __( 'Table ordered by Title.' ) : __( 'Table ordered by Hierarchical Menu Order and Title.' );
|
||||
$sortables = array(
|
||||
'title' => array( 'title', false, __( 'Title' ), $title_orderby_text, 'asc' ),
|
||||
'parent' => array( 'parent', false ),
|
||||
'comments' => array( 'comment_count', false, __( 'Comments' ), __( 'Table ordered by Comments.' ) ),
|
||||
'date' => array( 'date', true, __( 'Date' ), __( 'Table ordered by Date.' ) ),
|
||||
);
|
||||
} else {
|
||||
$sortables = array(
|
||||
'title' => array( 'title', false, __( 'Title' ), __( 'Table ordered by Title.' ) ),
|
||||
'parent' => array( 'parent', false ),
|
||||
'comments' => array( 'comment_count', false, __( 'Comments' ), __( 'Table ordered by Comments.' ) ),
|
||||
'date' => array( 'date', true, __( 'Date' ), __( 'Table ordered by Date.' ), 'desc' ),
|
||||
);
|
||||
}
|
||||
// Custom Post Types: there's a filter for that, see get_column_info().
|
||||
|
||||
return $sortables;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user