Skip to content

Commit

Permalink
keyboard help content adjustments for GFLBasics, phetsims/gravity-for…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Apr 24, 2019
1 parent ccfcf0d commit 883df95
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions js/SceneryPhetA11yStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ define( function( require ) {
keyboardHelpDialogExitDialogDescription: {
value: 'Exit a dialog with Escape key.'
},
toggleCheckboxesDescription: {
value: 'Toggle checkboxes with Space key.'
},

// help descriptions for sliders
keyboardHelpDialogAdjustDefaultStepsString: {
Expand Down
17 changes: 13 additions & 4 deletions js/keyboard/help/GeneralKeyboardHelpSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ define( function( require ) {
var keyboardHelpDialogMoveToPreviousItemOrGroupString = require( 'string!SCENERY_PHET/keyboardHelpDialog.moveToPreviousItemOrGroup' );
var keyboardHelpDialogMoveToPreviousItemString = require( 'string!SCENERY_PHET/keyboardHelpDialog.moveToPreviousItem' );
var keyboardHelpDialogPressButtonsString = require( 'string!SCENERY_PHET/keyboardHelpDialog.pressButtons' );
var keyboardHelpDialogToggleCheckboxString = require( 'string!SCENERY_PHET/keyboardHelpDialog.toggleCheckboxes' );

// a11y strings
var keyboardHelpDialogTabDescriptionString = SceneryPhetA11yStrings.keyboardHelpDialogTabDescription.value;
var keyboardHelpDialogShiftTabDescriptionString = SceneryPhetA11yStrings.keyboardHelpDialogShiftTabDescription.value;
var keyboardHelpDialogPressButtonsDescriptionString = SceneryPhetA11yStrings.keyboardHelpDialogPressButtonsDescription.value;
var keyboardHelpDialogGroupNavigationDescriptionString = SceneryPhetA11yStrings.keyboardHelpDialogGroupNavigationDescription.value;
var keyboardHelpDialogExitDialogDescriptionString = SceneryPhetA11yStrings.keyboardHelpDialogExitDialogDescription.value;
var toggleCheckboxesDescriptionString = SceneryPhetA11yStrings.toggleCheckboxesDescription.value;

/**
* @constructor
Expand All @@ -41,7 +43,8 @@ define( function( require ) {
function GeneralKeyboardHelpSection( options ) {

options = _.extend( {
withGroupContent: false // if true, the help content will include information about how to interact with groups
withGroupContent: false, // if true, the help content will include information about how to interact with groups
withCheckboxContent: false // if true, the help content will include information about how to interact with checkboxes
}, options );

// 'press buttons' content
Expand All @@ -52,7 +55,7 @@ define( function( require ) {
var exitADialogIcon = new EscapeKeyNode();
var exitADialogRow = KeyboardHelpSection.labelWithIcon( keyboardHelpDialogExitADialogString, exitADialogIcon, keyboardHelpDialogExitDialogDescriptionString );

var content = [ pressButtonsItemRow, exitADialogRow ];
var content = [ pressButtonsItemRow, exitADialogRow ];

var nextItemString;
var previousItemString;
Expand All @@ -66,16 +69,22 @@ define( function( require ) {
var leftRightArrowsIcon = KeyboardHelpSection.leftRightArrowKeysRowIcon();
var upDownArrowsIcon = KeyboardHelpSection.upDownArrowKeysRowIcon();
var leftRightOrUpDownIcon = KeyboardHelpSection.iconOrIcon( leftRightArrowsIcon, upDownArrowsIcon );
var moveBetweenItemsInAGroupRow = KeyboardHelpSection.labelWithIcon( keyboardHelpDialogMoveBetweenItemsInAGroupString, leftRightOrUpDownIcon, keyboardHelpDialogGroupNavigationDescriptionString );
var moveBetweenItemsInAGroupRow = KeyboardHelpSection.labelWithIcon( keyboardHelpDialogMoveBetweenItemsInAGroupString,
leftRightOrUpDownIcon, keyboardHelpDialogGroupNavigationDescriptionString );

// the "group" content row row comes just before the "exite a dialog" row
content.splice( content.indexOf( exitADialogRow ), 0, moveBetweenItemsInAGroupRow );
content.splice( content.indexOf( exitADialogRow ), 0, moveBetweenItemsInAGroupRow );
}
else {
nextItemString = keyboardHelpDialogMoveToNextItemString;
previousItemString = keyboardHelpDialogMoveToPreviousItemString;
}

if ( options.withCheckboxContent ) {
content.push( KeyboardHelpSection.labelWithIcon( keyboardHelpDialogToggleCheckboxString, new SpaceKeyNode(),
toggleCheckboxesDescriptionString ) );
}

// 'move to next item' content
var moveToNextItemIcon = new TabKeyNode();
var moveToNextItemRow = KeyboardHelpSection.labelWithIcon( nextItemString, moveToNextItemIcon, keyboardHelpDialogTabDescriptionString );
Expand Down
3 changes: 3 additions & 0 deletions scenery-phet-strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"keyboardHelpDialog.exitADialog": {
"value": "Exit a dialog"
},
"keyboardHelpDialog.toggleCheckboxes": {
"value": "Toggle checkboxes"
},
"keyboardHelpDialog.or": {
"value": "or"
},
Expand Down

0 comments on commit 883df95

Please sign in to comment.