From 9dfbd009477682bd8560a7fef29a7a9f394dd41b Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Fri, 5 Jun 2015 05:00:23 +0000 Subject: [PATCH] Text improvements for screen readers in list table paginations. Removes title attributes where reasonable and uses accessible hidden text. Screen readers will now correctly read out all available information. Props afercia, rianrietveld. Fixes #32028. git-svn-id: https://develop.svn.wordpress.org/trunk@32693 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/list-tables.css | 5 +++- src/wp-admin/includes/class-wp-list-table.php | 29 ++++++++++--------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index 8d1837f0e6..cd36f72c7c 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -544,7 +544,7 @@ th.asc a:focus span.sorting-indicator { cursor: default; height: 30px; color: #555; - line-height: 30px; + line-height: 2.5; font-size: 12px; } @@ -563,8 +563,10 @@ th.asc a:focus span.sorting-indicator { padding: 0 10px 3px; background: #eee; background: rgba( 0, 0, 0, 0.05 ); + display: inline-block; font-size: 16px; font-weight: normal; + line-height: 1.3333; } .tablenav .tablenav-pages a:hover, @@ -1614,6 +1616,7 @@ div.action-links, .tablenav-pages .pagination-links a { padding: 8px 20px 11px; + display: inline; font-size: 18px; background: rgba(0, 0, 0, 0.05); } diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index c58b11c487..3acb4d5830 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -701,6 +701,9 @@ class WP_List_Table { $page_links = array(); + $total_pages_before = ''; + $total_pages_after = ''; + $disable_first = $disable_last = ''; if ( $current == 1 ) { $disable_first = ' disabled'; @@ -708,44 +711,44 @@ class WP_List_Table { if ( $current == $total_pages ) { $disable_last = ' disabled'; } - $page_links[] = sprintf( "%s", + $page_links[] = sprintf( "%s", 'first-page' . $disable_first, - esc_attr__( 'Go to the first page' ), esc_url( remove_query_arg( 'paged', $current_url ) ), + __( 'First page' ), '«' ); - $page_links[] = sprintf( "%s", + $page_links[] = sprintf( "%s", 'prev-page' . $disable_first, - esc_attr__( 'Go to the previous page' ), esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ), + __( 'Previous page' ), '‹' ); if ( 'bottom' == $which ) { - $html_current_page = $current; + $html_current_page = $current; + $total_pages_before = ''; } else { - $html_current_page = sprintf( "%s", - '', - esc_attr__( 'Current page' ), + $html_current_page = sprintf( "%s", + '', $current, strlen( $total_pages ) ); } $html_total_pages = sprintf( "%s", number_format_i18n( $total_pages ) ); - $page_links[] = '' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . ''; + $page_links[] = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . $total_pages_after; - $page_links[] = sprintf( "%s", + $page_links[] = sprintf( "%s", 'next-page' . $disable_last, - esc_attr__( 'Go to the next page' ), esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ), + __( 'Next page' ), '›' ); - $page_links[] = sprintf( "%s", + $page_links[] = sprintf( "%s", 'last-page' . $disable_last, - esc_attr__( 'Go to the last page' ), esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ), + __( 'Last page' ), '»' );