Skip to content

Commit 7cf66ef

Browse files
committed
ensure message is read even when same content
1 parent d503fbd commit 7cf66ef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ariaNotify-polyfill.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ if (!("ariaNotify" in Element.prototype)) {
186186
*/
187187
handleMessage(key = null, message = "") {
188188
if (passkey !== key) return;
189+
// This is a hack due to the way the aria live API works. A screen reader
190+
// will not read a live region again if the text is the same. Adding a
191+
// space character tells the browser that the live region has updated,
192+
// which will cause it to read again, but with no audible difference.
193+
if (this.#shadowRoot.textContent == message) message += "\u00A0";
189194
this.#shadowRoot.textContent = message;
190195
}
191196
}

0 commit comments

Comments
 (0)