Make WordPress Core

Ticket #32170: 32170.patch

File 32170.patch, 1.6 KB (added by joedolson, 10 years ago)

Add screen reader text for sort directions; turn on sort icon

  • wp-admin/css/list-tables.css

     
    364364}
    365365
    366366.sorting-indicator {
    367         display: none;
    368367        width: 10px;
    369368        height: 4px;
    370369        margin-top: 8px;
     
    373372
    374373.sorting-indicator:before {
    375374        background: none;
    376         content: '\f142';
    377375        font: normal 20px/1 'dashicons';
    378376        speak: none;
    379377        display: inline-block;
  • wp-admin/includes/class-wp-list-table.php

     
    907907                                        $class[] = 'sortable';
    908908                                        $class[] = $desc_first ? 'asc' : 'desc';
    909909                                }
    910 
    911                                 $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
     910                               
     911                                $current_order_text = ( $current_order == 'asc' ) ? __( 'ascending' ) : __( 'descending' );
     912                                $order_text = ( $order == 'asc' ) ? __( 'ascending' ) : __( 'descending' );
     913                                $sort_order_text = sprintf( __( 'Sorted in %s order. Click to sort %s' ), $current_order_text, $order_text );
     914                               
     915                                $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"><span class="screen-reader-text">' . $sort_order_text . '</span></span></a>';
    912916                        }
    913917
    914918                        $id = $with_id ? "id='$column_key'" : '';