Skip to content

Commit

Permalink
add onInputValueChange to AccessiblePeer for phetsims/sun#397
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Sep 11, 2018
1 parent 1325608 commit 4a419ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/accessibility/Accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,10 @@ define( function( require ) {
value = '' + value;
this._inputValue = value;

this.setAccessibleAttribute( 'value', value );
for ( var i = 0; i < this.accessibleInstances.length; i++ ) {
var peer = this.accessibleInstances[ i ].peer;
peer.onInputValueChange();
}
},
set inputValue( value ) { this.setInputValue( value ); },

Expand Down
8 changes: 8 additions & 0 deletions js/accessibility/AccessiblePeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@ define( function( require ) {
}
},

/**
* Set the input value on the peer's primary sibling element. Using the value setter seems to be the only way
* to have the value be set correctly so we cannot use onAttributeChange for this.
*/
onInputValueChange: function() {
this.primarySibling.value = this.node.inputValue;
},

/**
* Called when our parallel DOM element gets focused.
* @private
Expand Down

0 comments on commit 4a419ee

Please sign in to comment.