Skip to content

Commit f1659f6

Browse files
committed
wip: Shift where the sleep happens
1 parent de0b170 commit f1659f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ariaNotify-polyfill.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ if (!("ariaNotify" in Element.prototype)) {
8787
);
8888
}
8989

90-
/** @returns {void} */
91-
announce() {
90+
/** @returns {Promise<void>} */
91+
async announce() {
9292
// Skip an unannounceable message.
9393
if (!this.#canAnnounce()) {
9494
return;
@@ -118,6 +118,7 @@ if (!("ariaNotify" in Element.prototype)) {
118118
root.append(liveRegion);
119119
}
120120

121+
await sleep(250);
121122
liveRegion.handleMessage(passkey, this.message);
122123
}
123124
}
@@ -165,7 +166,6 @@ if (!("ariaNotify" in Element.prototype)) {
165166
this.#currentMessage = this.#queue.shift();
166167
if (!this.#currentMessage) return;
167168
await this.#currentMessage.announce();
168-
await sleep(250);
169169
this.#processNext();
170170
}
171171
})();

0 commit comments

Comments
 (0)