Skip to content

Commit

Permalink
helpText accessibleName supports append sibling options, #795
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jul 29, 2018
1 parent 6d5964d commit 4555fba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions js/accessibility/Accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ define( function( require ) {
//TODO: assertions for if using lower api too? https://github.com/phetsims/scenery/issues/795
options.descriptionTagName = AccessibilityUtil.DEFAULT_DESCRIPTION_TAG_NAME;
options.descriptionContent = helpText;
options.appendDescription = true;
return options;
};
},
Expand Down
9 changes: 5 additions & 4 deletions js/accessibility/AccessiblePeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ define( function( require ) {
this._descriptionSibling = descriptionSibling;
this._containerParent = containerParent;

this.orderElements();
this.orderElements( options );

// @private {function} - Referenced for disposal
this.focusEventListener = this.focusEventListener || this.onFocus.bind( this );
Expand Down Expand Up @@ -244,9 +244,10 @@ define( function( require ) {
/**
* Handle the internal ordering of the elements in the peer, this involves setting the proper value of
* this.topLevelElements
* @param {Object} options - the computed mixin options to be applied to the peer.
* @private
*/
orderElements: function() {
orderElements: function( options ) {

var truthySiblings = [ this._labelSibling, this._descriptionSibling, this._primarySibling ].filter( function( i ) { return i; } );

Expand All @@ -265,8 +266,8 @@ define( function( require ) {
}

// insert the label and description elements in the correct location if they exist
this._labelSibling && this.arrangeContentElement( this._labelSibling, this.node.appendLabel );
this._descriptionSibling && this.arrangeContentElement( this._descriptionSibling, this.node.appendDescription );
this._labelSibling && this.arrangeContentElement( this._labelSibling, options.appendLabel );
this._descriptionSibling && this.arrangeContentElement( this._descriptionSibling, options.appendDescription );

},

Expand Down

0 comments on commit 4555fba

Please sign in to comment.