From 75da6803b87acd5631d9ade73816c183ab1fabc4 Mon Sep 17 00:00:00 2001 From: Michael Kauzmann Date: Fri, 7 Oct 2022 10:21:51 -0600 Subject: [PATCH] better check for voicing + assertion, https://github.com/phetsims/ratio-and-proportion/issues/509 --- js/Sim.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/Sim.ts b/js/Sim.ts index 85ee9fc4..5e0e02a5 100644 --- a/js/Sim.ts +++ b/js/Sim.ts @@ -736,9 +736,10 @@ export default class Sim extends PhetioObject { } ); this.display.simulationRoot.addChild( this.navigationBar ); - if ( this.toolbar ) { - this.display.simulationRoot.addChild( this.toolbar ); - this.display.simulationRoot.pdomOrder = [ this.toolbar ]; + if ( this.preferencesModel.audioModel.supportsVoicing ) { + assert && assert( this.toolbar, 'toolbar should exist for voicing' ); + this.display.simulationRoot.addChild( this.toolbar! ); + this.display.simulationRoot.pdomOrder = [ this.toolbar! ]; // If Voicing is not "fully" enabled, only the toolbar is able to produce Voicing output. // All other simulation components should not voice anything. This must be called only after