phetsims / utterance-queue

Alerting library powered by aria-live
MIT License
0 stars 2 forks source link

Move UtteranceQueue to its own repo #1

Closed zepumph closed 4 years ago

zepumph commented 4 years ago

This was a side project that was discussed in the last few weeks with @emily-phet and @jessegreenberg as something that @twant may be able to tackle as a back burner project. The priority of it may shift as we think about https://github.com/phetsims/molarity/issues/155 and how a fix for alerts firing in full-screen mode in Chrome may be to have scenery control the UtteranceQueue.

On hold until we decide exactly what to do over in that issue.

zepumph commented 4 years ago

Initial commit is done, next steps:

twant commented 4 years ago

@zepumph and I worked on adding initialization code to scenery and supporting self build tonight. We moved initialization code from Sim.js to Display.js, and then modified scenery's config files to require utteranceQueue (and added the necessary main.js file to utterance-queue). We were able to successfully build and run the built version of scenery with utteranceQueue in it.

However, we realized in some runtimes where more than one display is being created, this implementation breaks everything because utteranceQueue is initialized multiple times (and it is a singleton). For that reason, we didn't commit as-is (see patch below). We think the way forward is to not make utteranceQueue a singleton so that there is one utteranceQueue initialized per display, as opposed to a single global utteranceQueue. @jessegreenberg what do you think about this?

```diff Index: utterance-queue/js/utteranceQueue.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- utterance-queue/js/utteranceQueue.js (revision 0cace57cddb4eb8c3af5b4b68aaea8cf941b8c18) +++ utterance-queue/js/utteranceQueue.js (date 1571791047000) @@ -284,6 +284,7 @@ * @public */ initialize() { + assert && assert( !this._initialized, 'cannot initialize utteranceQueue twice' ); this._initialized = true; // begin stepping the queue Index: scenery/js/display/Display.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery/js/display/Display.js (revision 7ebcb28b8f65bd19793ce61831c7aeba3fac98a1) +++ scenery/js/display/Display.js (date 1571786292000) @@ -88,6 +88,7 @@ require( 'SCENERY/util/Trail' ); // const SceneryStyle = require( 'SCENERY/util/SceneryStyle' ); const AccessibleInstance = require( 'SCENERY/accessibility/AccessibleInstance' ); + const ariaHerald = require( 'UTTERANCE_QUEUE/ariaHerald' ); const CanvasNodeBoundsOverlay = require( 'SCENERY/overlays/CanvasNodeBoundsOverlay' ); const FittedBlockBoundsOverlay = require( 'SCENERY/overlays/FittedBlockBoundsOverlay' ); const FocusIO = require( 'SCENERY/accessibility/FocusIO' ); @@ -97,6 +98,7 @@ const PointerAreaOverlay = require( 'SCENERY/overlays/PointerAreaOverlay' ); const PointerOverlay = require( 'SCENERY/overlays/PointerOverlay' ); const Util = require( 'SCENERY/util/Util' ); + const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); /** * Constructs a Display that will show the rootNode and its subtree in a visual state. Default options provided below @@ -188,6 +190,7 @@ // @public (scenery-internal) {boolean} - Whether accessibility is enabled for this particular display. this._accessible = options.accessibility; + this._allowWebGL = options.allowWebGL; // The (integral, > 0) dimensions of the Display's DOM element (only updates the DOM element on updateDisplay()) @@ -319,6 +322,10 @@ // add the accessible DOM as a child of this DOM element this._domElement.appendChild( this._rootAccessibleInstance.peer.primarySibling ); + + // utteranceQueue depends on ariaHerald so initialize it first. + ariaHerald.initialize(); + utteranceQueue.initialize(); } } Index: scenery/js/scenery-test-config.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery/js/scenery-test-config.js (revision 7ebcb28b8f65bd19793ce61831c7aeba3fac98a1) +++ scenery/js/scenery-test-config.js (date 1571790802000) @@ -39,9 +39,10 @@ SCENERY_PHET: '../../scenery-phet/js', SUN: '../../sun/js', TAMBO: '../../tambo/js', - TANDEM: '../../tandem/js' + TANDEM: '../../tandem/js', + UTTERANCE_QUEUE: '../../utterance-queue/js' }, - // optional cache bust to make browser refresh load all included scripts, can be disabled with ?cacheBust=false + // Cache busting is applied by default, but can be disabled via ?cacheBust=false, see initialize-globals.js urlArgs: phet.chipper.getCacheBustArgs() } ); Index: scenery/js/scenery-config.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery/js/scenery-config.js (revision 7ebcb28b8f65bd19793ce61831c7aeba3fac98a1) +++ scenery/js/scenery-config.js (date 1571792350000) @@ -24,8 +24,10 @@ DOT: '../../dot/js', PHET_CORE: '../../phet-core/js', AXON: '../../axon/js', + UTTERANCE_QUEUE: '../../utterance-queue/js', TANDEM: '../../tandem/js', + REPOSITORY: '..' }, Index: scenery/js/scenery-main.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery/js/scenery-main.js (revision 7ebcb28b8f65bd19793ce61831c7aeba3fac98a1) +++ scenery/js/scenery-main.js (date 1571792350000) @@ -13,6 +13,7 @@ window.dot = require( 'DOT/main' ); window.kite = require( 'KITE/main' ); window.phetCore = require( 'PHET_CORE/main' ); + window.utteranceQueue = require( 'UTTERANCE_QUEUE/main' ); window.scenery = require( 'main' ); window.scenery.Util.polyfillRequestAnimationFrame(); } ); Index: scenery/js/config.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery/js/config.js (revision 7ebcb28b8f65bd19793ce61831c7aeba3fac98a1) +++ scenery/js/config.js (date 1571787439000) @@ -8,7 +8,7 @@ require.config( { // depends on all of Scenery, Kite, Dot, Axon and phet-core - deps: [ 'main', 'KITE/main', 'DOT/main', 'AXON/main', 'PHET_CORE/main' ], + deps: [ 'main', 'KITE/main', 'DOT/main', 'AXON/main', 'PHET_CORE/main', 'UTTERANCE_QUEUE/main'], paths: { @@ -26,7 +26,8 @@ PHET_CORE: '../../phet-core/js', SCENERY: '.', TANDEM: '../../tandem/js', - + UTTERANCE_QUEUE: '../../utterance-queue/js', + REPOSITORY: '..' }, Index: scenery/scenery-tests.html IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery/scenery-tests.html (revision 7ebcb28b8f65bd19793ce61831c7aeba3fac98a1) +++ scenery/scenery-tests.html (date 1571790802000) @@ -7,7 +7,7 @@ - + scenery @@ -25,58 +25,61 @@
- + \ No newline at end of file Index: scenery/package.json IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery/package.json (revision 7ebcb28b8f65bd19793ce61831c7aeba3fac98a1) +++ scenery/package.json (date 1571790189000) @@ -21,7 +21,8 @@ "kite": "KITE/main", "dot": "DOT/main", "axon": "AXON/main", - "phetCore": "PHET_CORE/main" + "phetCore": "PHET_CORE/main", + "utteranceQueue": "UTTERANCE_QUEUE/main" }, "finalizeJS": "scenery.Util.polyfillRequestAnimationFrame();" }, Index: joist/js/Sim.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- joist/js/Sim.js (revision 6036d95ea43eb7a3c0589568246cf82477f6f23b) +++ joist/js/Sim.js (date 1571786408000) @@ -14,7 +14,6 @@ // modules const Action = require( 'AXON/Action' ); - const ariaHerald = require( 'UTTERANCE_QUEUE/ariaHerald' ); const BarrierRectangle = require( 'SCENERY_PHET/BarrierRectangle' ); const BooleanProperty = require( 'AXON/BooleanProperty' ); const Bounds2 = require( 'DOT/Bounds2' ); @@ -50,7 +49,7 @@ const timer = require( 'AXON/timer' ); const updateCheck = require( 'JOIST/updateCheck' ); const Util = require( 'SCENERY/util/Util' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); + // ifphetio const phetioEngine = require( 'ifphetio!PHET_IO/phetioEngine' ); @@ -433,9 +432,6 @@ // public (read-only) {boolean} - if true, add support specific to accessible technology that work with touch devices. this.supportsTouchA11y = this.isAccessible && SUPPORTS_TOUCH_A11Y; - // Set up accessibility features for the sim. - this.isAccessible && initializeAccessibility(); - // @public (joist-internal, read-only) this.keyboardHelpNode = options.keyboardHelpNode; @@ -664,16 +660,6 @@ joist.register( 'Sim', Sim ); - /** - * Initialized all features of accessibility that should be enabled for the simulation. - */ - function initializeAccessibility() { - - // utteranceQueue depends on ariaHerald so initialize it first. - ariaHerald.initialize(); - utteranceQueue.initialize(); - } - return inherit( Object, Sim, { /**
jessegreenberg commented 4 years ago

@twant changes in https://github.com/phetsims/utterance-queue/issues/1#issuecomment-545219238 look great! I agree, it seems like having one utteranceQueue and one ariaHerald per Display makes most sense. Especially since the aria-live elements are going to move under the Display div.

zepumph commented 4 years ago

We worked on this more today, and got much further. There are some minor tweaks to try to work out, but we got things working with two large patches to come (no commits)

Here are next steps for us:

We ran aqua fuzzing on phet brand and fuzzBoard, but there is more to do. Ways we need to test:

Here is the patch with the main logic. These changes include:

Feature patch ```diff Index: molarity/molarity_a11y_view.html IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- molarity/molarity_a11y_view.html (revision 4b1c5ca92f1e763c7e0f8ff5bccc23e719e1c0bc) +++ molarity/molarity_a11y_view.html (date 1572399328054) @@ -269,10 +269,10 @@ var PDOMCopy = PDOMRoot.cloneNode( true ); // get the alert dom elements from the iframe's inner document - var politeElement1 = innerDoc.getElementById( 'polite-1' ); - var politeElement2 = innerDoc.getElementById( 'polite-2' ); - var politeElement3 = innerDoc.getElementById( 'polite-3' ); - var politeElement4 = innerDoc.getElementById( 'polite-4' ); + var politeElement1 = innerDoc.getElementById( 'elements-1-polite-1' ); + var politeElement2 = innerDoc.getElementById( 'elements-1-polite-2' ); + var politeElement3 = innerDoc.getElementById( 'elements-1-polite-3' ); + var politeElement4 = innerDoc.getElementById( 'elements-1-polite-4' ); // get the alert dom elements from the PDOM copy var alertList = document.getElementById( 'alert-list' ); Index: molarity/molarity_en.html IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- molarity/molarity_en.html (revision 4b1c5ca92f1e763c7e0f8ff5bccc23e719e1c0bc) +++ molarity/molarity_en.html (date 1572399327594) @@ -14,14 +14,6 @@ - -
-

-

-

-

-
- + \ No newline at end of file ```

Here is the patch where we updated utteranceQueue singleton usages to support coming from the sim's display.

Usages of utteranceQueue ```diff Index: sun/js/accessibility/AccessibleValueHandler.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- sun/js/accessibility/AccessibleValueHandler.js (revision da585bb71ca9947717434a3a3e34c5b120e71be7) +++ sun/js/accessibility/AccessibleValueHandler.js (date 1572399129562) @@ -29,9 +29,7 @@ const sun = require( 'SUN/sun' ); const Util = require( 'DOT/Util' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // constants +// constants const DEFAULT_TAG_NAME = 'input'; const toString = v => v + ''; @@ -349,6 +347,7 @@ */ setUtteranceAndAlert() { if ( this.a11yCreateValueChangeAlert ) { + const utteranceQueue = phet.joist.sim.display.utteranceQueue; this.onEndInteractionUtterance.resetTimingVariables(); Index: molarity/js/molarity/view/molarityAlertManager.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- molarity/js/molarity/view/molarityAlertManager.js (revision 4b1c5ca92f1e763c7e0f8ff5bccc23e719e1c0bc) +++ molarity/js/molarity/view/molarityAlertManager.js (date 1572399001045) @@ -14,8 +14,7 @@ const molarity = require( 'MOLARITY/molarity' ); const MolarityA11yStrings = require( 'MOLARITY/molarity/MolarityA11yStrings' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); +const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); const ValueChangeUtterance = require( 'UTTERANCE_QUEUE/ValueChangeUtterance' ); // a11y strings @@ -128,8 +127,8 @@ this.useQuantitativeDescriptionsProperty ); // clears the utteranceQueue to remove utterances from previous saturation region, then adds the saturation utterance. - utteranceQueue.clear(); - utteranceQueue.addToFront( this.saturationUtterance ); + phet.joist.sim.display.utteranceQueue.clear(); + phet.joist.sim.display.utteranceQueue.addToFront( this.saturationUtterance ); } /** @@ -141,7 +140,7 @@ this.sliderUtterance.alert = useQuantitativeDescriptionsProperty.value ? noSoluteQuantitativeAlertString : noSoluteQualitativeAlertString; - utteranceQueue.addToBack( this.sliderUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.sliderUtterance ); } /** @@ -150,7 +149,7 @@ */ alertSoluteChanged() { this.soluteUtterance.alert = this.soluteDescriber.getSoluteChangedAlertString( this.useQuantitativeDescriptionsProperty ); - utteranceQueue.addToBack( this.soluteUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.soluteUtterance ); } /** @@ -162,7 +161,7 @@ this.valuesVisibleUtterance.alert = valuesVisibleProperty ? solutionValuesCheckedAlertString : solutionValuesUncheckedAlertString; - utteranceQueue.addToBack( this.valuesVisibleUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.valuesVisibleUtterance ); } /** @@ -200,7 +199,7 @@ } this.sliderUtterance.alert = alertText; - utteranceQueue.addToBack( this.sliderUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.sliderUtterance ); } @@ -223,7 +222,7 @@ } this.sliderUtterance.alert = alertText; - utteranceQueue.addToBack( this.sliderUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.sliderUtterance ); } } Index: inverse-square-law-common/js/view/ISLCAlertManager.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- inverse-square-law-common/js/view/ISLCAlertManager.js (date 1572388326000) +++ inverse-square-law-common/js/view/ISLCAlertManager.js (date 1572399000920) @@ -15,9 +15,7 @@ const ActivationUtterance = require( 'UTTERANCE_QUEUE/ActivationUtterance' ); const inverseSquareLawCommon = require( 'INVERSE_SQUARE_LAW_COMMON/inverseSquareLawCommon' ); const ISLCA11yStrings = require( 'INVERSE_SQUARE_LAW_COMMON/ISLCA11yStrings' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // strings +// strings const forceValuesHiddenString = ISLCA11yStrings.forceValuesHidden.value; class ISLCAlertManager { @@ -52,7 +50,7 @@ } this.showForceValuesUtterance.alert = alert; - utteranceQueue.addToBack( this.showForceValuesUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.showForceValuesUtterance ); } } Index: inverse-square-law-common/js/view/ISLCRulerNode.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- inverse-square-law-common/js/view/ISLCRulerNode.js (date 1572388326000) +++ inverse-square-law-common/js/view/ISLCRulerNode.js (date 1572399000916) @@ -27,8 +27,7 @@ const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const Util = require( 'DOT/Util' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const Vector2 = require( 'DOT/Vector2' ); +const Vector2 = require( 'DOT/Vector2' ); // strings const unitsCentimetersString = require( 'string!INVERSE_SQUARE_LAW_COMMON/units.centimeters' ); @@ -202,7 +201,7 @@ onGrab: () => { grabbedUtterance.alert = rulerDescriber.getRulerGrabbedAlertable(); - utteranceQueue.addToBack( grabbedUtterance); + phet.joist.sim.display.utteranceQueue.addToBack( grabbedUtterance); }, listenersForDrag: [ keyboardDragListener ] Index: gravity-force-lab-basics/js/gravity-force-lab-basics/view/GFLBAlertManager.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- gravity-force-lab-basics/js/gravity-force-lab-basics/view/GFLBAlertManager.js (revision a33a6c6c8312eb563102c08c08bf1a8e69127ae0) +++ gravity-force-lab-basics/js/gravity-force-lab-basics/view/GFLBAlertManager.js (date 1572399000945) @@ -13,9 +13,7 @@ const GFLBA11yStrings = require( 'GRAVITY_FORCE_LAB_BASICS/gravity-force-lab-basics/GFLBA11yStrings' ); const GravityForceLabAlertManager = require( 'GRAVITY_FORCE_LAB/gravity-force-lab/view/GravityForceLabAlertManager' ); const gravityForceLabBasics = require( 'GRAVITY_FORCE_LAB_BASICS/gravityForceLabBasics' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const distanceArrowVisibleString = GFLBA11yStrings.distanceArrowVisible.value; const distanceArrowRemovedString = GFLBA11yStrings.distanceArrowRemoved.value; @@ -50,7 +48,7 @@ */ alertDistanceVisible( showDistance ) { this.distanceVisibleUtterance.alert = showDistance ? distanceArrowVisibleString : distanceArrowRemovedString; - utteranceQueue.addToBack( this.distanceVisibleUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.distanceVisibleUtterance ); } } Index: ohms-law/js/ohms-law/view/ControlPanel.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ohms-law/js/ohms-law/view/ControlPanel.js (revision 8e6f079f1ec1bb311df4637d32b61935541f638b) +++ ohms-law/js/ohms-law/view/ControlPanel.js (date 1572399000948) @@ -23,8 +23,7 @@ const SliderUnit = require( 'OHMS_LAW/ohms-law/view/SliderUnit' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const Util = require( 'DOT/Util' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const ValueChangeUtterance = require( 'UTTERANCE_QUEUE/ValueChangeUtterance' ); +const ValueChangeUtterance = require( 'UTTERANCE_QUEUE/ValueChangeUtterance' ); // strings const resistanceString = require( 'string!OHMS_LAW/resistance' ); @@ -105,7 +104,7 @@ const fixedCurrent = Util.toFixed( currentProperty.get(), OhmsLawConstants.CURRENT_SIG_FIGS ); voltageUtterance.alert = self.getValueChangeAlertString( letterVString, sizeChange, sizeChange, fixedCurrent ); - utteranceQueue.addToBack( voltageUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( voltageUtterance ); } } }, @@ -140,7 +139,7 @@ iSizeChange += Math.abs( currentChange ) > twoSizeCurrentThreshhold ? ' ' + aLotString : ''; resistanceUtterance.alert = self.getValueChangeAlertString( letterRString, rSizeChange, iSizeChange, fixedCurrent ); - utteranceQueue.addToBack( resistanceUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( resistanceUtterance ); } }; Index: gravity-force-lab/js/gravity-force-lab/view/GravityForceLabAlertManager.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- gravity-force-lab/js/gravity-force-lab/view/GravityForceLabAlertManager.js (date 1572388793000) +++ gravity-force-lab/js/gravity-force-lab/view/GravityForceLabAlertManager.js (date 1572399000955) @@ -16,8 +16,7 @@ const ISLCAlertManager = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCAlertManager' ); const merge = require( 'PHET_CORE/merge' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const ValueChangeUtterance = require( 'UTTERANCE_QUEUE/ValueChangeUtterance' ); +const ValueChangeUtterance = require( 'UTTERANCE_QUEUE/ValueChangeUtterance' ); // a11y strings const constantRadiusThinkDensityPatternString = GravityForceLabA11yStrings.constantRadiusThinkDensityPattern.value; @@ -74,7 +73,7 @@ model.constantRadiusProperty.lazyLink( constantRadius => { constantRadiusUtterance.alert = constantRadius ? constantRadiusAlert : massDescriber.getM1RelativeSize(); - utteranceQueue.addToBack( constantRadiusUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( constantRadiusUtterance ); } ); if ( options.linkToScientificNotationProperty ) { @@ -111,7 +110,7 @@ */ alertScientificNotation() { this.scientificNotationUtterance.alert = this.forceDescriber.getScientificNotationAlertText(); - utteranceQueue.addToBack( this.scientificNotationUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.scientificNotationUtterance ); } /** @@ -137,7 +136,7 @@ massClause: massClause, forceClause: this.forceDescriber.getVectorChangeClause( forceBiggerOverride, false ) } ); - utteranceQueue.addToBack( this.massChangedUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.massChangedUtterance ); } /** @@ -147,7 +146,7 @@ this.massChangedUtterance.alert = StringUtils.fillIn( sentencePatternString, { sentence: this.forceDescriber.getVectorChangeClause( false, true ) } ); - utteranceQueue.addToBack( this.massChangedUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.massChangedUtterance ); } } Index: molecules-and-light/js/moleculesandlight/view/MoleculeSelectionPanel.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- molecules-and-light/js/moleculesandlight/view/MoleculeSelectionPanel.js (revision 2f58fbc6e168d52f8d8faaad723e73354a18739b) +++ molecules-and-light/js/moleculesandlight/view/MoleculeSelectionPanel.js (date 1572399000988) @@ -34,8 +34,7 @@ const RichText = require( 'SCENERY/nodes/RichText' ); const Shape = require( 'KITE/Shape' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const Vector2 = require( 'DOT/Vector2' ); +const Vector2 = require( 'DOT/Vector2' ); //strings const molecularNamePatternString = require( 'string!MOLECULES_AND_LIGHT/molecularNamePattern' ); @@ -191,7 +190,7 @@ // var handleMoleculeChange = function( event ) { // var photonTarget = model.photonTargetProperty.get(); // var utteranceText = StringUtils.fillIn( moleculeSelectionAlertPatternString, { target: PhotonTarget.getMoleculeName( photonTarget ) } ); - // utteranceQueue.addToBack( new Utterance( { alert: utteranceText } ); + // phet.joist.sim.display.utteranceQueue.addToBack( new Utterance( { alert: utteranceText } ); // }; // radioButtons.addInputListener( { @@ -203,7 +202,7 @@ */ const moleculeChangeAlert = function( target ) { const utteranceText = StringUtils.fillIn( moleculeSelectionAlertPatternString, { target: PhotonTarget.getMoleculeName( target ) } ); - utteranceQueue.addToBack( utteranceText ); + phet.joist.sim.display.utteranceQueue.addToBack( utteranceText ); }; model.photonTargetProperty.link( moleculeChangeAlert ); Index: molecules-and-light/js/moleculesandlight/view/QuadEmissionFrequencyControlPanel.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- molecules-and-light/js/moleculesandlight/view/QuadEmissionFrequencyControlPanel.js (revision 2f58fbc6e168d52f8d8faaad723e73354a18739b) +++ molecules-and-light/js/moleculesandlight/view/QuadEmissionFrequencyControlPanel.js (date 1572399000959) @@ -27,8 +27,7 @@ const RadioButtonGroup = require( 'SUN/buttons/RadioButtonGroup' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const Text = require( 'SCENERY/nodes/Text' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const WavelengthConstants = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/WavelengthConstants' ); +const WavelengthConstants = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/WavelengthConstants' ); // images const flashlight2Image = require( 'mipmap!MOLECULES_AND_LIGHT/flashlight.png' ); @@ -207,7 +206,7 @@ wavelengthSelectionAlertPatternString, { wavelength: WavelengthConstants.getLightSourceName( wavelength ) } ); - utteranceQueue.addToBack( utteranceText ); + phet.joist.sim.display.utteranceQueue.addToBack( utteranceText ); }; photonAbsorptionModel.photonWavelengthProperty.link( handleWavelengthChangeAlert ); Index: balloons-and-static-electricity/js/balloons-and-static-electricity/view/describers/BalloonDescriber.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- balloons-and-static-electricity/js/balloons-and-static-electricity/view/describers/BalloonDescriber.js (revision 57c986671ab8d938a4ff9a7b4a019b81593b1789) +++ balloons-and-static-electricity/js/balloons-and-static-electricity/view/describers/BalloonDescriber.js (date 1572399000969) @@ -34,8 +34,7 @@ const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const SweaterDescriber = require( 'BALLOONS_AND_STATIC_ELECTRICITY/balloons-and-static-electricity/view/describers/SweaterDescriber' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const Vector2 = require( 'DOT/Vector2' ); +const Vector2 = require( 'DOT/Vector2' ); const WallDescriber = require( 'BALLOONS_AND_STATIC_ELECTRICITY/balloons-and-static-electricity/view/describers/WallDescriber' ); // a11y strings @@ -174,13 +173,13 @@ // the first charge pickup and subsequent pickups (behind a refresh rate) should be announced if ( self.alertNextPickup || self.alertFirstPickup ) { alert = self.getChargePickupDescription( self.alertFirstPickup ); - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); } // announce pickup of last charge, as long as charges are visible if ( Math.abs( chargeVal ) === BASEConstants.MAX_BALLOON_CHARGE && self.showChargesProperty.get() !== 'none' ) { alert = self.getLastChargePickupDescription(); - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); } // reset flags @@ -191,7 +190,7 @@ // when visibility changes, generate the alert and be sure to describe initial movement the next time the // balloon is released or added to the play area balloon.isVisibleProperty.lazyLink( function( isVisible ) { - utteranceQueue.addToBack( self.getVisibilityChangedDescription() ); + phet.joist.sim.display.utteranceQueue.addToBack( self.getVisibilityChangedDescription() ); self.initialMovementDescribed = false; self.preventNoMovementAlert = true; } ); @@ -199,7 +198,7 @@ // a11y - if we enter/leave the sweater announce that immediately balloon.onSweaterProperty.link( function( onSweater ) { if ( balloon.isDraggedProperty.get() ) { - utteranceQueue.addToBack( self.movementDescriber.getOnSweaterString( onSweater ) ); + phet.joist.sim.display.utteranceQueue.addToBack( self.movementDescriber.getOnSweaterString( onSweater ) ); } // entering sweater, indicate that we need to alert the next charge pickup @@ -212,7 +211,7 @@ if ( !self.balloonModel.jumping ) { if ( self.describeDirection ) { self.directionUtterance.alert = self.movementDescriber.getDirectionChangedDescription(); - utteranceQueue.addToBack( self.directionUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( self.directionUtterance ); } } } ); @@ -713,13 +712,13 @@ if ( model.onSweater() || model.touchingWall() ) { // while dragging, just attractive state and location - utteranceQueue.addToBack( this.movementDescriber.getAttractiveStateAndLocationDescriptionWithLabel() ); + phet.joist.sim.display.utteranceQueue.addToBack( this.movementDescriber.getAttractiveStateAndLocationDescriptionWithLabel() ); } } else if ( model.onSweater() ) { // if we stop on the sweater, announce that we are sticking to it - utteranceQueue.addToBack( this.movementDescriber.getAttractiveStateAndLocationDescriptionWithLabel() ); + phet.joist.sim.display.utteranceQueue.addToBack( this.movementDescriber.getAttractiveStateAndLocationDescriptionWithLabel() ); } else { @@ -727,7 +726,7 @@ // special case: if the balloon is touching the wall for the first time, don't describe this because // the section of this function observing that state will describe this if ( nextTouchingWall === this.describedTouchingWall ) { - utteranceQueue.addToBack( this.movementDescriber.getMovementStopsDescription() ); + phet.joist.sim.display.utteranceQueue.addToBack( this.movementDescriber.getMovementStopsDescription() ); } } } @@ -778,7 +777,7 @@ // assign an id so that we only announce the most recent alert in the utteranceQueue this.movementUtterance.alert = utterance; - utteranceQueue.addToBack( this.movementUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.movementUtterance ); } // describe the change in induced charge due to balloon dragging @@ -795,7 +794,7 @@ } this.inducedChargeChangeUtterance.alert = utterance; - utteranceQueue.addToBack( this.inducedChargeChangeUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.inducedChargeChangeUtterance ); } // update flags that indicate which alerts should come next @@ -818,14 +817,14 @@ if ( !model.jumping ) { if ( nextTouchingWall ) { if ( model.isDraggedProperty.get() && this.showChargesProperty.get() === 'all' ) { - utteranceQueue.addToBack( this.getWallRubbingDescriptionWithChargePairs() ); + phet.joist.sim.display.utteranceQueue.addToBack( this.getWallRubbingDescriptionWithChargePairs() ); this.describeWallRub = false; } else { // generates a description of how the balloon interacts with the wall if ( nextVisible ) { - utteranceQueue.addToBack( this.movementDescriber.getMovementStopsDescription() ); + phet.joist.sim.display.utteranceQueue.addToBack( this.movementDescriber.getMovementStopsDescription() ); } } } @@ -838,7 +837,7 @@ if ( nextIsDragged ) { utterance = this.movementDescriber.getGrabbedAlert(); - utteranceQueue.addToBack( utterance ); + phet.joist.sim.display.utteranceQueue.addToBack( utterance ); // we have been picked up successfully, start describing direction this.describeDirection = true; @@ -876,7 +875,7 @@ if ( !nextVelocity.equals( Vector2.ZERO ) ) { utterance = this.movementDescriber.getInitialReleaseDescription(); - utteranceQueue.addToBack( utterance ); + phet.joist.sim.display.utteranceQueue.addToBack( utterance ); // after describing initial movement, continue to describe direction changes this.describeDirection = true; @@ -887,7 +886,7 @@ // when the balloon is first added to the play area if ( !this.preventNoMovementAlert ) { utterance = this.movementDescriber.getNoChangeReleaseDescription(); - utteranceQueue.addToBack( utterance ); + phet.joist.sim.display.utteranceQueue.addToBack( utterance ); } this.preventNoMovementAlert = false; } @@ -901,7 +900,7 @@ // if the balloon is moving slowly, alert a continuous movement description if ( this.movementDescriber.balloonMovingAtContinousDescriptionVelocity() ) { utterance = this.movementDescriber.getContinuousReleaseDescription(); - utteranceQueue.addToBack( utterance ); + phet.joist.sim.display.utteranceQueue.addToBack( utterance ); // reset timer this.timeSinceReleaseAlert = 0; @@ -915,7 +914,7 @@ if ( this.rubAlertDirty ) { if ( nextIsDragged && model.onSweater() ) { this.chargeUtterance.alert = this.getNoChargePickupDescription(); - utteranceQueue.addToBack( this.chargeUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.chargeUtterance ); } } } Index: balloons-and-static-electricity/js/balloons-and-static-electricity/view/ControlPanel.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- balloons-and-static-electricity/js/balloons-and-static-electricity/view/ControlPanel.js (revision 57c986671ab8d938a4ff9a7b4a019b81593b1789) +++ balloons-and-static-electricity/js/balloons-and-static-electricity/view/ControlPanel.js (date 1572399000943) @@ -29,8 +29,7 @@ const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const Text = require( 'SCENERY/nodes/Text' ); const TwoSceneSelectionNode = require( 'BALLOONS_AND_STATIC_ELECTRICITY/balloons-and-static-electricity/view/TwoSceneSelectionNode' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const VBox = require( 'SCENERY/nodes/VBox' ); +const VBox = require( 'SCENERY/nodes/VBox' ); const VerticalAquaRadioButtonGroup = require( 'SUN/VerticalAquaRadioButtonGroup' ); // images @@ -110,7 +109,7 @@ self.wallButton.innerContent = model.wall.isVisibleProperty.get() ? removeWallString : addWallString; const alertDescription = wallVisible ? wallAddedString : wallRemovedString; - utteranceQueue.addToBack( alertDescription ); + phet.joist.sim.display.utteranceQueue.addToBack( alertDescription ); } ); // Radio buttons related to charges @@ -168,7 +167,7 @@ } assert && assert( alertString, 'no interactive alert for showChargesProperty value ' + value ); - utteranceQueue.addToBack( alertString ); + phet.joist.sim.display.utteranceQueue.addToBack( alertString ); } ); // Radio buttons for selecting 1 vs 2 balloons @@ -228,17 +227,17 @@ const resetBalloonButtonListener = function() { // disable other alerts until after we are finished resetting the balloons - utteranceQueue.enabled = false; + phet.joist.sim.display.utteranceQueue.enabled = false; model.sweater.reset(); model.balloons.forEach( function( balloon ) { balloon.reset( true ); } ); - utteranceQueue.enabled = true; + phet.joist.sim.display.utteranceQueue.enabled = true; // alert to assistive technology - utteranceQueue.addToBack( StringUtils.fillIn( resetBalloonsAlertPatternString, { + phet.joist.sim.display.utteranceQueue.addToBack( StringUtils.fillIn( resetBalloonsAlertPatternString, { balloons: model.greenBalloon.isVisibleProperty.get() ? balloonsString : balloonString } ) ); }; Index: balloons-and-static-electricity/js/balloons-and-static-electricity/view/BalloonNode.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- balloons-and-static-electricity/js/balloons-and-static-electricity/view/BalloonNode.js (revision 57c986671ab8d938a4ff9a7b4a019b81593b1789) +++ balloons-and-static-electricity/js/balloons-and-static-electricity/view/BalloonNode.js (date 1572399000934) @@ -37,8 +37,7 @@ const Rectangle = require( 'SCENERY/nodes/Rectangle' ); const Shape = require( 'KITE/Shape' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const Vector2 = require( 'DOT/Vector2' ); +const Vector2 = require( 'DOT/Vector2' ); // a11y - critical x locations for the balloon const X_LOCATIONS = PlayAreaMap.X_LOCATIONS; @@ -236,7 +235,7 @@ if ( self.attemptToMoveBeyondBoundary( event.domEvent.keyCode ) ) { const attemptedDirection = self.getAttemptedMovementDirection( event.domEvent.keyCode ); boundaryUtterance.alert = self.describer.movementDescriber.getTouchingBoundaryDescription( attemptedDirection ); - utteranceQueue.addToBack( boundaryUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( boundaryUtterance ); } } } ); @@ -365,11 +364,11 @@ this.model.setCenter( center ); // clear the queue of utterances that collected as position changed - utteranceQueue.clear(); + phet.joist.sim.display.utteranceQueue.clear(); // Send a custom alert, depending on where the balloon was moved to this.jumpingUtterance.alert = this.describer.movementDescriber.getJumpingDescription( center ); - utteranceQueue.addToBack( this.jumpingUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( this.jumpingUtterance ); // reset forces in tracked values in describer that determine description for induced charge change this.describer.chargeDescriber.resetReferenceForces(); Index: friction/js/friction/view/describers/TemperatureIncreasingDescriber.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- friction/js/friction/view/describers/TemperatureIncreasingDescriber.js (revision f3fd4a7fa06ca9f7df0d6f9b140f9a8213e39b60) +++ friction/js/friction/view/describers/TemperatureIncreasingDescriber.js (date 1572399000976) @@ -23,9 +23,7 @@ const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const timer = require( 'AXON/timer' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const moreString = FrictionA11yStrings.more.value; const fasterString = FrictionA11yStrings.faster.value; const nowHotterString = FrictionA11yStrings.nowHotter.value; @@ -159,7 +157,7 @@ * @private */ alertMaxTemp() { - this.alert( () => { utteranceQueue.addToBack( this.maxTempUtterance ); } ); + this.alert( () => { phet.joist.sim.display.utteranceQueue.addToBack( this.maxTempUtterance ); } ); } /** Index: friction/js/friction/view/describers/BreakAwayDescriber.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- friction/js/friction/view/describers/BreakAwayDescriber.js (revision f3fd4a7fa06ca9f7df0d6f9b140f9a8213e39b60) +++ friction/js/friction/view/describers/BreakAwayDescriber.js (date 1572399001013) @@ -14,9 +14,7 @@ const FrictionModel = require( 'FRICTION/friction/model/FrictionModel' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const timer = require( 'AXON/timer' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const capitalizedVeryHotString = FrictionA11yStrings.capitalizedVeryHot.value; const breakAwaySentenceFirstString = FrictionA11yStrings.breakAwaySentenceFirst.value; const breakAwaySentenceAgainString = FrictionA11yStrings.breakAwaySentenceAgain.value; @@ -76,10 +74,10 @@ // If there aren't any more atoms to break away if ( this.model.numberOfAtomsEvaporated >= FrictionModel.NUMBER_OF_EVAPORABLE_ATOMS ) { assert && assert( this.alertedBreakAwayProperty.value, 'If this is the first alert, then we have problems' ); - utteranceQueue.addToFront( BREAK_AWAY_NONE_LEFT ); + phet.joist.sim.display.utteranceQueue.addToFront( BREAK_AWAY_NONE_LEFT ); } else { - utteranceQueue.addToFront( this.alertedBreakAwayProperty.value ? BREAK_AWAY_THRESHOLD_AGAIN : BREAK_AWAY_THRESHOLD_FIRST ); + phet.joist.sim.display.utteranceQueue.addToFront( this.alertedBreakAwayProperty.value ? BREAK_AWAY_THRESHOLD_AGAIN : BREAK_AWAY_THRESHOLD_FIRST ); } this.alertedBreakAwayProperty.value = true; Index: friction/js/friction/view/FrictionGrabDragInteraction.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- friction/js/friction/view/FrictionGrabDragInteraction.js (revision f3fd4a7fa06ca9f7df0d6f9b140f9a8213e39b60) +++ friction/js/friction/view/FrictionGrabDragInteraction.js (date 1572399000957) @@ -13,9 +13,7 @@ const FrictionModel = require( 'FRICTION/friction/model/FrictionModel' ); const GrabDragInteraction = require( 'SCENERY_PHET/accessibility/GrabDragInteraction' ); const merge = require( 'PHET_CORE/merge' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const initialGrabbedNotTouchingString = FrictionA11yStrings.initialGrabbedNotTouching.value; const grabbedNotTouchingString = FrictionA11yStrings.grabbedNotTouching.value; const initialGrabbedTouchingString = FrictionA11yStrings.initialGrabbedTouching.value; @@ -55,7 +53,7 @@ if ( this.successfullyInteracted ) { alert = alerts.subsequent; } - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); }; super( wrappedNode, options ); Index: friction/js/friction/view/FrictionAlertManager.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- friction/js/friction/view/FrictionAlertManager.js (revision f3fd4a7fa06ca9f7df0d6f9b140f9a8213e39b60) +++ friction/js/friction/view/FrictionAlertManager.js (date 1572399000949) @@ -12,9 +12,7 @@ const FrictionA11yStrings = require( 'FRICTION/friction/FrictionA11yStrings' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const frictionIncreasingAtomsJigglingTemperatureFirstPatternString = FrictionA11yStrings.frictionIncreasingAtomsJigglingTemperatureFirstPattern.value; const frictionIncreasingAtomsJigglingTemperaturePatternString = FrictionA11yStrings.frictionIncreasingAtomsJigglingTemperaturePattern.value; const atomsJiggleTinyBitTempCoolString = FrictionA11yStrings.atomsJiggleTinyBitTempCool.value; @@ -49,7 +47,7 @@ } ); temperatureJiggleUtterance.alert = string; - utteranceQueue.addToBack( temperatureJiggleUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( temperatureJiggleUtterance ); }, /** @@ -57,7 +55,7 @@ * @public */ alertSettledAndCool: function() { - utteranceQueue.addToBack( atomsJiggleTinyBitTempCoolString ); + phet.joist.sim.display.utteranceQueue.addToBack( atomsJiggleTinyBitTempCoolString ); }, // Threshold that must be reached from initial temp to new temp to alert that the temperature changed, in amplitude (see model for more info) Index: joist/js/NavigationBarSoundToggleButton.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- joist/js/NavigationBarSoundToggleButton.js (revision 21d163d28b186bf0a7b3226ca769402a0d8a0d38) +++ joist/js/NavigationBarSoundToggleButton.js (date 1572399000912) @@ -23,8 +23,7 @@ const Rectangle = require( 'SCENERY/nodes/Rectangle' ); const Shape = require( 'KITE/Shape' ); const ToggleNode = require( 'SUN/ToggleNode' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const Vector2 = require( 'DOT/Vector2' ); +const Vector2 = require( 'DOT/Vector2' ); // a11y strings const soundOnOffString = JoistA11yStrings.soundOnOffButton.value; @@ -156,7 +155,7 @@ self.setAccessibleAttribute( 'aria-pressed', !value ); soundUtterance.alert = value ? simSoundOnString : simSoundOffString; - utteranceQueue.addToBack( soundUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( soundUtterance ); }; soundEnabledProperty.lazyLink( pressedListener ); this.setAccessibleAttribute( 'aria-pressed', !soundEnabledProperty.get() ); Index: a11y-research/js/abswitch-test/js/abswitch-test/view/AbswitchTestScreenView.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- a11y-research/js/abswitch-test/js/abswitch-test/view/AbswitchTestScreenView.js (revision b2786f488dfee56e4f937d06553afcc02f242787) +++ a11y-research/js/abswitch-test/js/abswitch-test/view/AbswitchTestScreenView.js (date 1572399129567) @@ -17,8 +17,7 @@ const Circle = require( 'SCENERY/nodes/Circle' ); const Rectangle = require( 'SCENERY/nodes/Rectangle' ); const Node = require( 'SCENERY/nodes/Node' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - const Text = require( 'SCENERY/nodes/Text' ); +const Text = require( 'SCENERY/nodes/Text' ); const VBox = require( 'SCENERY/nodes/VBox' ); const PhetFont = require( 'SCENERY_PHET/PhetFont' ); @@ -30,6 +29,8 @@ ScreenView.call( this ); + const utteranceQueue = phet.joist.sim.display.utteranceQueue; + var font = new PhetFont( 20 ); //-------------------------------------------------------------------------- Index: faradays-law/js/faradays-law/view/FaradaysLawAlertManager.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- faradays-law/js/faradays-law/view/FaradaysLawAlertManager.js (revision b478ead61bbb2d9e3be7ccb72aadaf62c0b29ff6) +++ faradays-law/js/faradays-law/view/FaradaysLawAlertManager.js (date 1572399001028) @@ -7,9 +7,7 @@ const faradaysLaw = require( 'FARADAYS_LAW/faradaysLaw' ); const MagnetDescriber = require( 'FARADAYS_LAW/faradays-law/view/MagnetDescriber' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // the alert manager +// the alert manager class FaradaysLawAlertManager { constructor( describer ) { @@ -22,37 +20,37 @@ magnetFocusAlert() { const alert = this.describer.magnetFocusAlertText; - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); } movementEndAlert() { this.keyboardMovementUtterance.alert = this.describer.magnetMovedAlertText(); - utteranceQueue.addToFront( this.keyboardMovementUtterance ); + phet.joist.sim.display.utteranceQueue.addToFront( this.keyboardMovementUtterance ); } flipMagnetAlert( orientation ) { const alert = this.describer.getFlipMagnetAlertText( orientation ); - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); } static magnetSlidingAlert( speed, direction ) { const alert = MagnetDescriber.getMagnetSlidingAlertText( speed, direction ); - utteranceQueue.addToFront( alert ); + phet.joist.sim.display.utteranceQueue.addToFront( alert ); } static voltmeterAttachmentAlert( showVoltmeter ) { const alert = MagnetDescriber.getVoltmeterAttachmentAlertText( showVoltmeter ); - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); } static fieldLinesVisibilityAlert( showLines ) { const alert = MagnetDescriber.getFieldLinesVisibilityAlertText( showLines ); - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); } static coilConnectionAlert( showTopCoil ) { const alert = MagnetDescriber.getCoilConnectionAlertText( showTopCoil ); - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); } } Index: faradays-law/js/faradays-law/view/ControlPanelNode.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- faradays-law/js/faradays-law/view/ControlPanelNode.js (revision b478ead61bbb2d9e3be7ccb72aadaf62c0b29ff6) +++ faradays-law/js/faradays-law/view/ControlPanelNode.js (date 1572398653397) @@ -151,7 +151,7 @@ model.voltmeterVisibleProperty.lazyLink( function( showVoltmeter ) { FaradaysLawAlertManager.voltmeterAttachmentAlert( showVoltmeter ); // const attachmentState = showVoltmeter ? connectedString : removedString; - // utteranceQueue.addToBack( StringUtils.fillIn( voltmeterAlertPatternString, { attachmentState } ) ); + // phet.joist.sim.display.utteranceQueue.addToBack( StringUtils.fillIn( voltmeterAlertPatternString, { attachmentState } ) ); } ); // Create the label for the "Show Field Lines" checkbox, scaling it if it's too long. Index: john-travoltage/js/john-travoltage/view/ElectronLayerNode.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- john-travoltage/js/john-travoltage/view/ElectronLayerNode.js (revision bb800c4fc427a0211e6d899c23c2fbbda95b4b02) +++ john-travoltage/js/john-travoltage/view/ElectronLayerNode.js (date 1572399000940) @@ -19,9 +19,7 @@ const Node = require( 'SCENERY/nodes/Node' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const electronsTotalString = JohnTravoltageA11yStrings.electronsTotal.value; const electronsTotalAfterDischargeString = JohnTravoltageA11yStrings.electronsTotalAfterDischarge.value; @@ -72,7 +70,7 @@ } electronUtterance.alert = alertString; - utteranceQueue.addToBack( electronUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( electronUtterance ); // for haptic feedback, experimental model.utteranceAddedEmitter.emit( alertString ); Index: scenery-phet/js/buttons/SoundToggleButton.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery-phet/js/buttons/SoundToggleButton.js (date 1572388327000) +++ scenery-phet/js/buttons/SoundToggleButton.js (date 1572399000991) @@ -22,9 +22,7 @@ const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' ); const SceneryPhetA11yStrings = require( 'SCENERY_PHET/SceneryPhetA11yStrings' ); const Shape = require( 'KITE/Shape' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // constants +// constants const WIDTH = 45; const HEIGHT = 45; const MARGIN = 4; @@ -79,7 +77,7 @@ self.setAccessibleAttribute( 'aria-pressed', !value ); const alertString = value ? simSoundOnString : simSoundOffString; - utteranceQueue.addToBack( alertString ); + phet.joist.sim.display.utteranceQueue.addToBack( alertString ); }; property.lazyLink( pressedListener ); self.setAccessibleAttribute( 'aria-pressed', !property.get() ); Index: scenery-phet/js/accessibility/describers/BorderAlertsDescriber.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery-phet/js/accessibility/describers/BorderAlertsDescriber.js (date 1572388327000) +++ scenery-phet/js/accessibility/describers/BorderAlertsDescriber.js (date 1572399000924) @@ -17,9 +17,7 @@ const SceneryPhetA11yStrings = require( 'SCENERY_PHET/SceneryPhetA11yStrings' ); const Util = require( 'DOT/Util' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const leftBorderAlertString = SceneryPhetA11yStrings.leftBorderAlert.value; const rightBorderAlertString = SceneryPhetA11yStrings.rightBorderAlert.value; const topBorderAlertString = SceneryPhetA11yStrings.topBorderAlert.value; @@ -179,7 +177,7 @@ } alert() { - utteranceQueue.addToBackIfDefined( this.getAlert() ); + phet.joist.sim.display.utteranceQueue.addToBackIfDefined( this.getAlert() ); this._numberOfTimesAlerted++; } Index: scenery-phet/js/accessibility/describers/MovementDescriber.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery-phet/js/accessibility/describers/MovementDescriber.js (date 1572388327000) +++ scenery-phet/js/accessibility/describers/MovementDescriber.js (date 1572399000952) @@ -20,9 +20,7 @@ const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' ); const SceneryPhetA11yStrings = require( 'SCENERY_PHET/SceneryPhetA11yStrings' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const downString = SceneryPhetA11yStrings.down.value; const leftString = SceneryPhetA11yStrings.left.value; const rightString = SceneryPhetA11yStrings.right.value; @@ -124,7 +122,7 @@ * @param {AlertableDef} alertable - anything that can be passed to UtteranceQueue */ alert( alertable ) { - utteranceQueue.addToBack( alertable ); + phet.joist.sim.display.utteranceQueue.addToBack( alertable ); this.lastAlertedLocation = this.locationProperty.get(); } Index: scenery-phet/js/accessibility/GrabDragInteraction.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery-phet/js/accessibility/GrabDragInteraction.js (date 1572388327000) +++ scenery-phet/js/accessibility/GrabDragInteraction.js (date 1572399000929) @@ -47,9 +47,7 @@ const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' ); const SceneryPhetA11yStrings = require( 'SCENERY_PHET/SceneryPhetA11yStrings' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const grabPatternString = SceneryPhetA11yStrings.grabPattern.value; const movableString = SceneryPhetA11yStrings.movable.value; const defaultObjectToGrabString = SceneryPhetA11yStrings.defaultObjectToGrab.value; @@ -217,7 +215,7 @@ // @private - wrap the optional onRelease in logic that is needed for the core type. this.onRelease = () => { options.onRelease && options.onRelease(); - utteranceQueue.addToBack( releasedString ); + phet.joist.sim.display.utteranceQueue.addToBack( releasedString ); }; this.onGrab = options.onGrab; // @private Index: scenery-phet/js/buttons/ResetAllButton.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- scenery-phet/js/buttons/ResetAllButton.js (date 1572388327000) +++ scenery-phet/js/buttons/ResetAllButton.js (date 1572399000918) @@ -23,9 +23,7 @@ const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' ); const SceneryPhetA11yStrings = require( 'SCENERY_PHET/SceneryPhetA11yStrings' ); const Tandem = require( 'TANDEM/Tandem' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // constants +// constants const RESET_ALL_BUTTON_RADIUS = 20.8; // a11y strings - not translatable @@ -69,13 +67,13 @@ // alert that everything was reset. const resetUtterance = new ActivationUtterance( { alert: resetAllAlertString } ); this.isFiringProperty.lazyLink( function( isFiring ) { - utteranceQueue.enabled = !isFiring; + phet.joist.sim.display.utteranceQueue.enabled = !isFiring; if ( isFiring ) { - utteranceQueue.clear(); + phet.joist.sim.display.utteranceQueue.clear(); } else { - utteranceQueue.addToBack( resetUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( resetUtterance ); } } ); } Index: resistance-in-a-wire/js/resistance-in-a-wire/view/ControlPanel.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- resistance-in-a-wire/js/resistance-in-a-wire/view/ControlPanel.js (revision 0a36acb0d8e86ab78971063223e39cd30c85ee89) +++ resistance-in-a-wire/js/resistance-in-a-wire/view/ControlPanel.js (date 1572399000995) @@ -25,9 +25,7 @@ const Text = require( 'SCENERY/nodes/Text' ); const Util = require( 'DOT/Util' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // strings +// strings const areaString = require( 'string!RESISTANCE_IN_A_WIRE/area' ); const areaSymbolString = require( 'string!RESISTANCE_IN_A_WIRE/areaSymbol' ); const cmString = require( 'string!RESISTANCE_IN_A_WIRE/cm' ); @@ -138,7 +136,7 @@ // rapidly if ( deltaRho && deltaResistance ) { changeUtterance.alert = getSizeChangeAlert( resistance, deltaResistance, deltaRho, letterRhoString ); - utteranceQueue.addToBack( changeUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( changeUtterance ); } }, sliderOptions: { @@ -171,7 +169,7 @@ // rapidly if ( deltaLength && deltaResistance ) { changeUtterance.alert = getSizeChangeAlert( resistance, deltaResistance, deltaLength, letterLString ); - utteranceQueue.addToBack( changeUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( changeUtterance ); } }, sliderOptions: { @@ -204,7 +202,7 @@ // rapidly if ( deltaArea && deltaResistance ) { changeUtterance.alert = getSizeChangeAlert( resistance, deltaResistance, deltaArea, letterAString ); - utteranceQueue.addToBack( changeUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( changeUtterance ); } }, sliderOptions: { ```
zepumph commented 4 years ago

Note: we really hate how large of a patch this is getting, but it still seems preferable to having N branches (at least 6, but could be more if we added usages). This is part of why we separated out the usages into another changeset, to keep the breadth down menially.

zepumph commented 4 years ago

I was getting a pane unavailable alert from NVDA. I couldn't pin when/why, but it happened a few times. Likely due to these changes.

@twant and I couldn't reproduce this today. We think it was caused because last week we didn't rebuild the a11y view before testing.

zepumph commented 4 years ago

perhaps give GFLB to QA, as they just tested it.

zepumph commented 4 years ago

@twant and I finally got this to a committable point. Most of today was not coding, but just testing the above patches, and working out kinks. There is still a pretty large list of follow up tasks, but they didn't need to be done in this first commit:

zepumph commented 4 years ago

Above are changes to the a11y view that remove assumptions about aria live element ids, and the number of them to monitor. We also created some side issues. We are ready to close this issue.

zepumph commented 4 years ago

Actually. This was a massive set of changes. It would be good to have @jessegreenberg look over it. Here is a list of files to look at for recent changes:

EDIT: JG converting to checkbox list to indicate what I reviewed.

jessegreenberg commented 4 years ago

These are looking great, additional things I noticed have new issues or have the open issues that you described. Is this ready to be closed?