diff --git a/js/create/view/MyChallengeAccordionBox.js b/js/create/view/MyChallengeAccordionBox.js index c6f6ba69..f0d2d539 100644 --- a/js/create/view/MyChallengeAccordionBox.js +++ b/js/create/view/MyChallengeAccordionBox.js @@ -14,7 +14,6 @@ import merge from '../../../../phet-core/js/merge.js'; import Fraction from '../../../../phetcommon/js/model/Fraction.js'; import NumberPicker from '../../../../scenery-phet/js/NumberPicker.js'; import PhetFont from '../../../../scenery-phet/js/PhetFont.js'; -import voicingManager from '../../../../scenery/js/accessibility/speaker/voicingManager.js'; import HBox from '../../../../scenery/js/nodes/HBox.js'; import Node from '../../../../scenery/js/nodes/Node.js'; import RichText from '../../../../scenery/js/nodes/RichText.js'; @@ -64,34 +63,8 @@ class MyChallengeAccordionBox extends AccordionBox { mouseAreaXDilation: 5, mouseAreaYDilation: 5, - voicingCreateObjectResponse: event => { - if ( event.type === 'focus' ) { - return ratioAndProportionStrings.myChallenge; - } - }, - voicingCreateContextResponse: event => { - if ( event.type === 'focus' ) { - - if ( voicingManager.objectChangesProperty.value ) { - const fullContextSentence = ratioDescriber.getMyChallengeSentence( targetAntecedentProperty.value, targetConsequentProperty.value ); - - // TODO: we don't have to do this once there is a better way to provide a call to collapseResponses from options. - assert && assert( fullContextSentence.startsWith( ratioAndProportionStrings.myChallenge ), 'assuming this starts with this string' ); - - return this.expandedProperty.value ? fullContextSentence.replace( ratioAndProportionStrings.myChallenge, '' ) : null; - } - else { - return null; - } - } - }, - voicingCreateHintResponse: event => { - if ( event.type === 'focus' ) { - return this.expandedProperty.value ? - ratioAndProportionStrings.a11y.create.myChallengeExpandedHintText : - ratioAndProportionStrings.a11y.create.myChallengeCollapsedHintText; - } - } + // voicing + voicingObjectResponse: ratioAndProportionStrings.myChallenge }, // phet-io @@ -184,30 +157,31 @@ class MyChallengeAccordionBox extends AccordionBox { const accordionBoxVoicingUtterance = new ActivationUtterance(); this.expandedProperty.lazyLink( expanded => { - if ( expanded ) { - accordionBoxUtterance.alert = ratioDescriber.getCurrentChallengeSentence( targetAntecedentProperty.value, targetConsequentProperty.value ); + // strings containing responses used for Voicing + let contextResponse = ''; + let hintResponse = ''; + if ( expanded ) { + contextResponse = ratioDescriber.getCurrentChallengeSentence( targetAntecedentProperty.value, targetConsequentProperty.value ); + hintResponse = ratioAndProportionStrings.a11y.create.myChallengeExpandedHintText; - accordionBoxVoicingUtterance.alert = voicingManager.collectResponses( { - objectResponse: ratioAndProportionStrings.myChallenge, - contextResponse: ratioDescriber.getMyChallengeSentence( targetAntecedentProperty.value, targetConsequentProperty.value ), - interactionHint: ratioAndProportionStrings.a11y.create.myChallengeExpandedHintText, - contextIncludesObjectResponse: true - } ); + accordionBoxUtterance.alert = ratioDescriber.getCurrentChallengeSentence( targetAntecedentProperty.value, targetConsequentProperty.value ); } else { + contextResponse = ratioAndProportionStrings.a11y.ratio.currentChallengeHidden; + hintResponse = ratioAndProportionStrings.a11y.create.myChallengeCollapsedHintText; + accordionBoxUtterance.alert = ratioAndProportionStrings.a11y.ratio.currentChallengeHidden; - accordionBoxVoicingUtterance.alert = - voicingManager.collectResponses( { - objectResponse: ratioAndProportionStrings.myChallenge, - contextResponse: ratioAndProportionStrings.a11y.ratio.myChallengeHidden, - interactionHint: ratioAndProportionStrings.a11y.create.myChallengeCollapsedHintText, - contextIncludesObjectResponse: true - } ); } + this.setButtonVoicingOptions( { + voicingContextResponse: contextResponse, + voicingHintResponse: hintResponse + } ); + + this.voicingSpeakButtonResponse( { utterance: accordionBoxVoicingUtterance } ); phet.joist.sim.utteranceQueue.addToBack( accordionBoxUtterance ); - phet.joist.sim.voicingUtteranceQueue && phet.joist.sim.voicingUtteranceQueue.addToBack( accordionBoxVoicingUtterance ); + } ); Property.multilink( [ targetAntecedentProperty, targetConsequentProperty ], ( targetAntecedent, targetConsequent ) => {