Accessibility: Make Safari 10 + VoiceOver announce repeated, identical, wp.a11y.speak()
messages.
Safari 10 + VoiceOver don't announce repeated, identical, strings sent to an `aria-live` region. Appending a `no-break space` to a repeated message string, forces them to think the strings are different. Fixes #36853. git-svn-id: https://develop.svn.wordpress.org/trunk@40479 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
94ad421722
commit
9c5ba6f387
@ -4,7 +4,8 @@ window.wp = window.wp || {};
|
||||
'use strict';
|
||||
|
||||
var $containerPolite,
|
||||
$containerAssertive;
|
||||
$containerAssertive,
|
||||
previousMessage = '';
|
||||
|
||||
/**
|
||||
* Update the ARIA live notification area text node.
|
||||
@ -23,6 +24,17 @@ window.wp = window.wp || {};
|
||||
// Ensure only text is sent to screen readers.
|
||||
message = $( '<p>' ).html( message ).text();
|
||||
|
||||
/*
|
||||
* Safari 10+VoiceOver don't announce repeated, identical strings. We use
|
||||
* a `no-break space` to force them to think identical strings are different.
|
||||
* See ticket #36853.
|
||||
*/
|
||||
if ( previousMessage === message ) {
|
||||
message = message + '\u00A0';
|
||||
}
|
||||
|
||||
previousMessage = message;
|
||||
|
||||
if ( $containerAssertive && 'assertive' === ariaLive ) {
|
||||
$containerAssertive.text( message );
|
||||
} else if ( $containerPolite ) {
|
||||
|
Loading…
Reference in New Issue
Block a user