Skip to content

Commit

Permalink
add setter function for updating child slider component aria-valuetex…
Browse files Browse the repository at this point in the history
…t, see #452
  • Loading branch information
mbarlow12 committed Jan 10, 2019
1 parent 333ab92 commit 6014b5e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/NumberControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ define( function( require ) {
assert && assert( options.arrowButtonOptions.tagName === undefined,
'NumberControl handles alternative input for arrow buttons' );
options.arrowButtonOptions.tagName = null;

var leftArrowButton = new ArrowButton( 'left', function() {
var value = numberProperty.get() - options.delta;
value = Util.roundToInterval( value, options.delta ); // constrain to multiples of delta, see #384
Expand All @@ -199,7 +199,7 @@ define( function( require ) {
}, _.extend( {
tandem: options.tandem.createTandem( 'rightArrowButton' ),
startCallback: options.rightArrowStartCallback || options.startCallback,
endCallback: options.rightArrowEndCallback || options.endCallback
endCallback: options.rightArrowEndCallback || options.endCallback
}, options.arrowButtonOptions ) );

var arrowEnabledListener = function( value ) {
Expand All @@ -220,7 +220,7 @@ define( function( require ) {

// a11y - shiftKeyboardStep is handled by clicking the arrow buttons
sliderOptions.shiftKeyboardStep = 0;

// Make sure Slider gets created with the right IO Type
sliderOptions.phetioType = SliderIO;

Expand Down Expand Up @@ -256,6 +256,11 @@ define( function( require ) {
slider.attemptedIncreaseEmitter.addListener( rightButtonListener );
slider.attemptedDecreaseEmitter.addListener( leftButtonListener );

// @public - expose setter for aria-valuetext for the slider
this.setAriaValueText = function( text ) {
slider.ariaValueText = text;
};

// enabled/disable this control
this.enabledProperty = options.enabledProperty; // @public
var enabledObserver = function( enabled ) {
Expand Down

0 comments on commit 6014b5e

Please sign in to comment.