Skip to content

Commit

Permalink
only log if container has focus and msg exists
Browse files Browse the repository at this point in the history
the former for consistency with the screen reader, and the latter
to not pollute the console with blank messages
  • Loading branch information
eluberoff committed Apr 3, 2023
1 parent 0b393ee commit 948285e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/services/aria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class Aria {
.join(' ')
.replace(/ +(?= )/g, '')
.trim();
if (this.controller.options.logAriaAlerts) {
console.log(this.msg);
}
if (this.controller.containerHasFocus()) {
if (this.controller.options.logAriaAlerts && this.msg) {
console.log(this.msg);
}
this.span.textContent = this.msg;
}
}
Expand Down

0 comments on commit 948285e

Please sign in to comment.