Skip to content

Commit

Permalink
separate grabbableHelpText -> addAriaDescribedBy, gestureHelpText, an…
Browse files Browse the repository at this point in the history
…d keyboardHelpText api, phetsims/scenery-phet#536
  • Loading branch information
zepumph committed Nov 4, 2019
1 parent 47bca6b commit f24dba7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
3 changes: 0 additions & 3 deletions js/balloons-and-static-electricity/BASEA11yStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,6 @@ define( require => {
grabBalloonKeyboardHelp: {
value: 'Look for grab button to play. Once grabbed, use letter keys W, A,S, or D key to move up, left, down, or right. Space to release.'
},
grabBalloonTouchHelp: {
value: 'Double tap and hold to drag balloon. Lift finger to release.'
},
balloonLocationAttractiveStatePattern: {
value: '{{attractiveState}} {{location}}'
},
Expand Down
12 changes: 1 addition & 11 deletions js/balloons-and-static-electricity/view/BalloonNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ define( require => {

// a11y strings
const grabBalloonKeyboardHelpString = BASEA11yStrings.grabBalloonKeyboardHelp.value;
const grabBalloonTouchHelpString = BASEA11yStrings.grabBalloonTouchHelp.value;

/**
* Constructor for the balloon
Expand Down Expand Up @@ -250,13 +249,6 @@ define( require => {
appendDescription: true
};

// devices that support touch a11y will use `grabbableHelpText` option so that the help text is read automatically
// when the user finds it - must be set explicitly here because `null` will override the value and `undefined`
// is disallowed
if ( !phet.joist.sim.supportsTouchA11y ) {
grabbableOptions.descriptionContent = grabBalloonKeyboardHelpString;
}

// attach the GrabDragInteraction to the image node, which is a child of this node so that the accessible
// content for the interaction is underneath this node
const grabDragInteraction = new GrabDragInteraction( balloonImageNode, {
Expand All @@ -267,9 +259,7 @@ define( require => {
centerTop: balloonImageNode.centerBottom.plusXY( 0, 10 )
},

// if on a device that supports accessible touch interaction, associate the description content with
// aria-describedby so it is read automatically
grabbableHelpText: phet.joist.sim.supportsTouchA11y ? grabBalloonTouchHelpString : null,
keyboardHelpText: grabBalloonKeyboardHelpString,

grabbableOptions: grabbableOptions,

Expand Down

0 comments on commit f24dba7

Please sign in to comment.