From 0687800e091d6e0c34a9e3d44d649814cec05385 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 25 Aug 2024 22:35:31 +0000 Subject: [PATCH] Comments: Announce reply notices to screen reader users. Improve experience for screen reader users by calling `wp.a11y.speak()` with the results of comment reply submissions within the WordPress dashboard. Props joedolson, khokansardar. Fixes #61480. git-svn-id: https://develop.svn.wordpress.org/trunk@58931 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/admin/edit-comments.js | 1 + src/wp-includes/script-loader.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/_enqueues/admin/edit-comments.js b/src/js/_enqueues/admin/edit-comments.js index e7a9282d4bb6d..e007edf465c6f 100644 --- a/src/js/_enqueues/admin/edit-comments.js +++ b/src/js/_enqueues/admin/edit-comments.js @@ -1188,6 +1188,7 @@ window.commentReply = { if ( er ) { $errorNotice.removeClass( 'hidden' ); $error.html( er ); + wp.a11y.speak( er ); } }, diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 19d25049c40bb..dcf86309b371e 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1397,7 +1397,7 @@ function wp_default_scripts( $scripts ) { $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 ); $scripts->set_translations( 'admin-tags' ); - $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query' ), false, 1 ); + $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query', 'wp-a11y' ), false, 1 ); $scripts->set_translations( 'admin-comments' ); did_action( 'init' ) && $scripts->localize( 'admin-comments',