Skip to content

Commit

Permalink
update voice when Announcer becomes initialized, see phetsims/number-…
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Jan 17, 2023
1 parent 8afa78b commit 3e1652f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/common/view/NumberSuiteCommonSpeechSynthesisAnnouncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ class NumberSuiteCommonSpeechSynthesisAnnouncer extends SpeechSynthesisAnnouncer
this.secondaryLocaleVoiceEnabledProperty = new DerivedProperty( [ secondLocaleProperty, this.voiceProperty ],
locale => this.testVoiceForLocale( locale ) );

// Voices may not be available on load or the list of voices may change - update if we get an indication that
// the list of available voices has changed.
// When the SpeechSynthesisAnnouncer becomes initialized or when voices change, update the voice used by this
// currently being used by this Announcer.
this.voicesProperty.lazyLink( this.updateVoiceListener );
this.isInitializedProperty.link( initialized => {
if ( initialized ) {
this.updateVoice();
}
} );
}

/**
Expand Down

0 comments on commit 3e1652f

Please sign in to comment.