Accessibility: List Tables: Hide the Comments column icon and title attribute from screen readers.

The element already has non-visual text, making the icon and the `title` attribute redundant for assistive technologies.

Follow-up to [22439], [27548], [31513], [32991], [50804].

Props sabernhardt, ryokuhi, afercia, karlgroves, SergeyBiryukov.
Fixes #55555. See #24766.

git-svn-id: https://develop.svn.wordpress.org/trunk@53414 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-05-19 15:52:03 +00:00
parent 0b6bc9a386
commit 96d6eae601
2 changed files with 7 additions and 2 deletions

View File

@ -350,8 +350,13 @@ class WP_Media_List_Table extends WP_List_Table {
/* translators: Column name. */
if ( ! $this->detached ) {
$posts_columns['parent'] = _x( 'Uploaded to', 'column name' );
if ( post_type_supports( 'attachment', 'comments' ) ) {
$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
$posts_columns['comments'] = sprintf(
'<span class="vers comment-grey-bubble" title="%1$s" aria-hidden="true"></span><span class="screen-reader-text">%2$s</span>',
esc_attr__( 'Comments' ),
__( 'Comments' )
);
}
}

View File

@ -691,7 +691,7 @@ class WP_Posts_List_Table extends WP_List_Table {
&& ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true )
) {
$posts_columns['comments'] = sprintf(
'<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%2$s</span></span>',
'<span class="vers comment-grey-bubble" title="%1$s" aria-hidden="true"></span><span class="screen-reader-text">%2$s</span>',
esc_attr__( 'Comments' ),
__( 'Comments' )
);