From ff895fd38060eb67fe4a12f05f44f59f6348bb39 Mon Sep 17 00:00:00 2001 From: zepumph Date: Mon, 3 May 2021 15:33:36 -0800 Subject: [PATCH] add cancelOther and have focus event handle object respones, https://github.com/phetsims/ratio-and-proportion/issues/384 and https://github.com/phetsims/sun/issues/699 --- js/common/view/TickMarkViewRadioButtonGroup.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/common/view/TickMarkViewRadioButtonGroup.js b/js/common/view/TickMarkViewRadioButtonGroup.js index 17914236..d207e6bd 100644 --- a/js/common/view/TickMarkViewRadioButtonGroup.js +++ b/js/common/view/TickMarkViewRadioButtonGroup.js @@ -13,6 +13,7 @@ import Path from '../../../../scenery/js/nodes/Path.js'; import RectangularRadioButtonGroup from '../../../../sun/js/buttons/RectangularRadioButtonGroup.js'; import FontAwesomeNode from '../../../../sun/js/FontAwesomeNode.js'; import ActivationUtterance from '../../../../utterance-queue/js/ActivationUtterance.js'; +import VoicingUtterance from '../../../../utterance-queue/js/VoicingUtterance.js'; import ratioAndProportion from '../../ratioAndProportion.js'; import ratioAndProportionStrings from '../../ratioAndProportionStrings.js'; import TickMarkView from './TickMarkView.js'; @@ -80,7 +81,12 @@ class TickMarkViewRadioButtonGroup extends RectangularRadioButtonGroup { options ); const tickMarkContextResponseUtterance = new ActivationUtterance(); - const tickMarkVoicingContextResponseUtterance = new ActivationUtterance(); + const tickMarkVoicingContextResponseUtterance = new VoicingUtterance( { + + // The object response for keyboard is handled by the focus event, so don't cancel that (which occurs before + // this in the listener order). + cancelOther: false + } ); tickMarkViewProperty.lazyLink( tickMarkView => { const currentRadioButtonItem = _.find( radioButtonItemData, item => item.value === tickMarkView ); @@ -88,11 +94,7 @@ class TickMarkViewRadioButtonGroup extends RectangularRadioButtonGroup { // voicing alert tickMarkVoicingContextResponseUtterance.alert = voicingManager.collectResponses( { - objectResponse: currentRadioButtonItem.labelContent, - contextResponse: currentRadioButtonItem.voicingContextResponse, - - // Context response includes objectResponse if both object and context are delivered - contextIncludesObjectResponse: voicingManager.objectChangesProperty.value && voicingManager.contextChangesProperty.value + contextResponse: currentRadioButtonItem.voicingContextResponse } ); phet.joist.sim.voicingUtteranceQueue.addToBack( tickMarkVoicingContextResponseUtterance );