diff --git a/plugins/woocommerce/changelog/60253-wooplug-4876-accessibility-key-notices-not-being-read-by-screen-readers b/plugins/woocommerce/changelog/60253-wooplug-4876-accessibility-key-notices-not-being-read-by-screen-readers new file mode 100644 index 00000000000..7399bb54981 --- /dev/null +++ b/plugins/woocommerce/changelog/60253-wooplug-4876-accessibility-key-notices-not-being-read-by-screen-readers @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fixed accessibility for all classic store notices added by the `wc_add_notice` function. \ No newline at end of file diff --git a/plugins/woocommerce/templates/notices/notice.php b/plugins/woocommerce/templates/notices/notice.php index 39cc00af8bc..02570d4af10 100644 --- a/plugins/woocommerce/templates/notices/notice.php +++ b/plugins/woocommerce/templates/notices/notice.php @@ -12,7 +12,7 @@ * * @see https://woocommerce.com/document/template-structure/ * @package WooCommerce\Templates - * @version 8.6.0 + * @version 10.2.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -26,7 +26,7 @@ if ( ! $notices ) { ?> -
> +
role="status">
diff --git a/plugins/woocommerce/tests/legacy/unit-tests/util/notice-functions.php b/plugins/woocommerce/tests/legacy/unit-tests/util/notice-functions.php index e447d1b9027..4e0a42ba3da 100644 --- a/plugins/woocommerce/tests/legacy/unit-tests/util/notice-functions.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/util/notice-functions.php @@ -119,7 +119,7 @@ class WC_Tests_Notice_Functions extends WC_Unit_Test_Case { wc_add_notice( 'One True Notice', 'notice' ); wc_add_notice( 'Second True Notice', 'notice', array( 'id' => 'second_notice' ) ); - $this->expectOutputString( '
One True Notice
Second True Notice
' ); + $this->expectOutputString( '
One True Notice
Second True Notice
' ); wc_print_notices(); @@ -131,7 +131,7 @@ class WC_Tests_Notice_Functions extends WC_Unit_Test_Case { * when first parameter is set to true. */ public function test_wc_print_notices_should_return_notices() { - $expected_return = "\n
\n One True Notice
\n"; + $expected_return = "\n
\n One True Notice
\n"; wc_add_notice( 'One True Notice', 'notice' ); @@ -161,7 +161,7 @@ class WC_Tests_Notice_Functions extends WC_Unit_Test_Case { */ public function test_wc_print_info_notice() { - $this->expectOutputString( '
Info!
' ); + $this->expectOutputString( '
Info!
' ); wc_print_notice( 'Info!', 'notice' ); }