Admin/Comments: remove bespoke truncation from search string HTML.

This change removes a call to `wp_html_excerpt()` used on the HTML output of the search string, supplied by the current user in the previous page request via the named `s` input in the search-box UI.

If the search string is extremely long, it wraps around the available empty space in a way that is not visually displeasing, confirming that truncation is not a requirement here.

This also addresses a small accessibility concern as the non-truncated string was not alternatively presented, and helps normalize the output of `$_REQUEST['s']` for more broad improvements in the future.

Props hareesh-pillai, jakubtyrcha, johnjamesjacoby, lukecavanagh, sabernhardt.

Fixes #17636.

git-svn-id: https://develop.svn.wordpress.org/trunk@51975 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John James Jacoby
2021-11-02 15:56:02 +00:00
parent 605e7d1b00
commit 4923d75fb1

View File

@@ -251,7 +251,7 @@ if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
printf(
/* translators: %s: Search query. */
__( 'Search results for: %s' ),
'<strong>' . wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' ) . '</strong>'
'<strong>' . esc_html( wp_unslash( $_REQUEST['s'] ) ) . '</strong>'
);
echo '</span>';
}