Skip to content

Commit

Permalink
use innerContent instead of accessibleName, see #237
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Dec 11, 2019
1 parent 45060d2 commit 8b6f581
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions js/moleculesandlight/view/ObservationWindowDescriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* energy phase is described. The initial state description for photons passing through the molecule is
* not re-applied until the photon wavelength or target molecule changes again.
*
* TODO: accessibleName was replaced throughout with innerContent because of https://github.com/phetsims/scenery/issues/1026
* If that issue is fixed, accessibleName can be used again
*
* @author Jesse Greenberg
*/
define( require => {
Expand Down Expand Up @@ -103,13 +106,13 @@ define( require => {
attachInitialPhaseDescriptionListeners( descriptionNode ) {
this.model.photonWavelengthProperty.link( photonWavelength => {
if ( this.model.targetMolecule ) {
descriptionNode.accessibleName = this.getInitialPhaseDescription( this.model.emissionFrequencyProperty.get(), photonWavelength, this.model.photonTargetProperty.get() );
descriptionNode.innerContent = this.getInitialPhaseDescription( this.model.emissionFrequencyProperty.get(), photonWavelength, this.model.photonTargetProperty.get() );
}
} );

this.model.emissionFrequencyProperty.link( ( emissionFrequency, oldFrequency ) => {
if ( ( emissionFrequency === 0 || oldFrequency === 0 ) && this.model.targetMolecule ) {
descriptionNode.accessibleName = this.getInitialPhaseDescription( emissionFrequency, this.model.photonWavelengthProperty.get(), this.model.photonTargetProperty.get() );
descriptionNode.innerContent = this.getInitialPhaseDescription( emissionFrequency, this.model.photonWavelengthProperty.get(), this.model.photonTargetProperty.get() );
}
} );
}
Expand All @@ -126,7 +129,7 @@ define( require => {

// new target molecule added, reset to initial phase description
if ( molecule === this.model.targetMolecule ) {
descriptionNode.accessibleName = this.getInitialPhaseDescription( this.model.emissionFrequencyProperty.get(), this.model.photonWavelengthProperty.get(), this.model.photonTargetProperty.get() );
descriptionNode.innerContent = this.getInitialPhaseDescription( this.model.emissionFrequencyProperty.get(), this.model.photonWavelengthProperty.get(), this.model.photonTargetProperty.get() );
}

// vibration
Expand All @@ -135,7 +138,7 @@ define( require => {

if ( this.moleculeVibrating ) {
this.wavelengthOnAbsorption = this.model.photonWavelengthProperty.get();
descriptionNode.accessibleName = this.getVibrationPhaseDescription( vibrationRadians );
descriptionNode.innerContent = this.getVibrationPhaseDescription( vibrationRadians );
}
} );

Expand All @@ -146,7 +149,7 @@ define( require => {

if ( rotating ) {
this.wavelengthOnAbsorption = this.model.photonWavelengthProperty.get();
descriptionNode.accessibleName = this.getRotationPhaseDescription();
descriptionNode.innerContent = this.getRotationPhaseDescription();
}
} );

Expand All @@ -156,21 +159,21 @@ define( require => {

if ( highEnergy ) {
this.wavelengthOnAbsorption = this.model.photonWavelengthProperty.get();
descriptionNode.accessibleName = this.getHighElectronicEnergyPhaseDescription();
descriptionNode.innerContent = this.getHighElectronicEnergyPhaseDescription();
}
} );

// re-emission
molecule.photonEmittedEmitter.addListener( photon => {
descriptionNode.accessibleName = this.getEmissionPhaseDescription( photon );
descriptionNode.innerContent = this.getEmissionPhaseDescription( photon );
} );

// break apart
molecule.brokeApartEmitter.addListener( ( moleculeA, moleculeB ) => {
this.moleculeBrokeApart = true;
this.wavelengthOnAbsorption = this.model.photonWavelengthProperty.get();

descriptionNode.accessibleName = this.getBreakApartPhaseDescription( moleculeA, moleculeB );
descriptionNode.innerContent = this.getBreakApartPhaseDescription( moleculeA, moleculeB );

const activeMolecules = this.model.activeMolecules;

Expand All @@ -181,7 +184,7 @@ define( require => {
const addMoleculeRemovalListener = () => {
const describeMoleculesRemoved = ( molecule, observableArray ) => {
if ( !activeMolecules.contains( moleculeA ) && !activeMolecules.contains( moleculeB ) ) {
descriptionNode.accessibleName = this.getMoleculesRemovedDescription( moleculeA, moleculeB );
descriptionNode.innerContent = this.getMoleculesRemovedDescription( moleculeA, moleculeB );
activeMolecules.removeItemRemovedListener( describeMoleculesRemoved );
}
};
Expand Down

0 comments on commit 8b6f581

Please sign in to comment.