From 6014b5e3d7aa884e2f267ef7e00faab682f6ef3b Mon Sep 17 00:00:00 2001 From: Michael Barlow Date: Wed, 9 Jan 2019 17:41:48 -0700 Subject: [PATCH] add setter function for updating child slider component aria-valuetext, see #452 --- js/NumberControl.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/NumberControl.js b/js/NumberControl.js index 6caa32c80..a1ce5f67a 100644 --- a/js/NumberControl.js +++ b/js/NumberControl.js @@ -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 @@ -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 ) { @@ -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; @@ -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 ) {