diff --git a/accessible/notifications.service.js b/accessible/notifications.service.js
index b3c9f4f2c..9e2b1d709 100644
--- a/accessible/notifications.service.js
+++ b/accessible/notifications.service.js
@@ -26,6 +26,7 @@
blocklyApp.NotificationsService = ng.core.Class({
constructor: [function() {
this.statusMessage_ = '';
+ this.timeouts = [];
}],
getStatusMessage: function() {
return this.statusMessage_;
@@ -34,12 +35,19 @@ blocklyApp.NotificationsService = ng.core.Class({
// Introduce a temporary status message, so that if, e.g., two "copy"
// operations are done in succession, both messages will be read.
this.statusMessage_ = '';
+ // Clear all existing timeouts.
+ this.timeouts.forEach(function(timeout) {
+ clearTimeout(timeout);
+ });
// We need a non-zero timeout here, otherwise NVDA does not read the
// notification messages properly.
var that = this;
- setTimeout(function() {
+ this.timeouts.push(setTimeout(function() {
that.statusMessage_ = newMessage;
- }, 20);
+ }, 20));
+ this.timeouts.push(setTimeout(function() {
+ that.statusMessage_ = '';
+ }, 2000));
}
});
diff --git a/accessible/sidebar.component.js b/accessible/sidebar.component.js
index e8890fe30..2c259ea70 100644
--- a/accessible/sidebar.component.js
+++ b/accessible/sidebar.component.js
@@ -33,13 +33,13 @@ blocklyApp.SidebarComponent = ng.core.Component({