Skip to content

Commit

Permalink
converted aria-labelled/describedby usages to new api, phetsims/scene…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jun 22, 2018
1 parent 1e1dca6 commit 4c870eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion js/AboutDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define( function( require ) {
'use strict';

// modules
var AccessiblePeer = require( 'SCENERY/accessibility/AccessiblePeer' );
var ButtonListener = require( 'SCENERY/input/ButtonListener' );
var CreditsNode = require( 'JOIST/CreditsNode' );
var Dialog = require( 'SUN/Dialog' );
Expand Down Expand Up @@ -210,7 +211,11 @@ define( function( require ) {
} );

// a11y - set label association so the title is read when focus enters the dialog
this.setAriaLabelledByNode( titleText );
this.addAriaLabelledbyAssociation( {
thisElementName: AccessiblePeer.PRIMARY_SIBLING,
otherNode: titleText,
otherElementName: AccessiblePeer.PRIMARY_SIBLING
} );

// close it on a click
var closeListener = new ButtonListener( {
Expand Down
9 changes: 6 additions & 3 deletions js/NavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,12 @@ define( function( require ) {
keyboardHelpButtonLayoutWidth = this.keyboardHelpButton.width + KEYBOARD_HELP_BUTTON_LEFT_MARGIN;
}

// a11y - tell this node that it is ariaLabelledBy its own labelContent.
this.ariaLabelledByNode = this;
this.ariaLabelContent = AccessiblePeer.LABEL_SIBLING;
// a11y - tell this node that it is aria-labelledby its own labelContent.
this.addAriaLabelledbyAssociation( {
thisElementName: AccessiblePeer.PRIMARY_SIBLING,
otherNode: this,
otherElementName: AccessiblePeer.LABEL_SIBLING
});

if ( screens.length === 1 ) {
/* single-screen sim */
Expand Down

0 comments on commit 4c870eb

Please sign in to comment.