From 96d6eae6013121394ed0a166459f5376567ffd36 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 19 May 2022 15:52:03 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/class-wp-media-list-table.php | 7 ++++++- src/wp-admin/includes/class-wp-posts-list-table.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index 5c0a6e6dab..baed19e1b3 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -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'] = '' . __( 'Comments' ) . ''; + $posts_columns['comments'] = sprintf( + '%2$s', + esc_attr__( 'Comments' ), + __( 'Comments' ) + ); } } diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 818abf48f6..4e7dad18c7 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -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( - '%2$s', + '%2$s', esc_attr__( 'Comments' ), __( 'Comments' ) );