Skip to content

Commit

Permalink
add accessibility to NumberControl through sliderOptions, added doc, #…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jul 31, 2019
1 parent 62520e3 commit 93b8d4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions js/NumberControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* Control for changing a Property of type {number}.
* Consists of a labeled value, slider and arrow buttons.
*
* Number Control provides accessible content exclusively through the slider, please pass accessibility related
* customizations through options to the slider.
*
* @author Chris Malley (PixelZoom, Inc.)
*/
define( require => {
Expand Down Expand Up @@ -169,7 +172,8 @@ define( require => {
// a11y - for alternative input, the number control is accessed entirely through slider interaction and these
// arrow buttons are not tab navigable
assert && assert( options.arrowButtonOptions.tagName === undefined,
'NumberControl handles alternative input for arrow buttons' );
'NumberControl\'s accessible content is just the slider, do not set accessible content on the buttons. Instead ' +
'set a11y through options.sliderOptions.' );
options.arrowButtonOptions.tagName = null;

// Slider options for track (if not specified as trackNode)
Expand Down Expand Up @@ -269,7 +273,7 @@ define( require => {
};
numberProperty.link( arrowEnabledListener );

// @public {HSlider} - for access to AccessibleValueHandler API
// @public {HSlider} - for access to accessibility API
this.slider = new HSlider( numberProperty, numberRange, options.sliderOptions );

// major ticks
Expand Down
6 changes: 3 additions & 3 deletions js/demo/ComponentsScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ define( function( require ) {
font: new PhetFont( 14 )
},
sliderOptions: {
trackSize: new Dimension2( 150, 3 )
},
containerTagName: 'div'
trackSize: new Dimension2( 150, 3 ),
containerTagName: 'div'
}
};
demoParent.addChild( new VBox( {
resize: false, // Don't readjust the size when the slider knob moves all the way to the right
Expand Down

0 comments on commit 93b8d4b

Please sign in to comment.