From f3dcf6bc79dde698e0504a4fc3eed3b94793d565 Mon Sep 17 00:00:00 2001 From: Jesse Greenberg Date: Wed, 10 Apr 2019 10:38:30 -0600 Subject: [PATCH] use single Utterance instead of uniqueGroupId, see phetsims/scenery-phet#485 --- js/faradays-law/view/FaradaysLawAlertManager.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/faradays-law/view/FaradaysLawAlertManager.js b/js/faradays-law/view/FaradaysLawAlertManager.js index a6f132b6..2d53310c 100644 --- a/js/faradays-law/view/FaradaysLawAlertManager.js +++ b/js/faradays-law/view/FaradaysLawAlertManager.js @@ -14,6 +14,10 @@ define( require => { constructor( describer ) { this.describer = describer; + + // @private {Utterance} - utterance for end of a keyboard movement, single utterance + // gets added to the utteranceQueue to prevent too many alerts with this content + this.keyboardMovementUtterance = new Utterance(); } magnetFocusAlert() { @@ -22,8 +26,8 @@ define( require => { } movementEndAlert() { - const alert = new Utterance( { alert: this.describer.magnetMovedAlertText(), uniqueGroupId: 'keyboardMove' } ); - utteranceQueue.addToFront( alert ); + this.keyboardMovementUtterance.alert = this.describer.magnetMovedAlertText(); + utteranceQueue.addToFront( this.keyboardMovementUtterance ); } flipMagnetAlert( orientation ) {