@@ -68,7 +68,7 @@ export class Slider extends FASTElement implements SliderConfiguration {
6868 switch ( propertyName ) {
6969 case 'min' :
7070 case 'max' :
71- this . setSliderPosition ( this . direction ) ;
71+ this . setSliderPosition ( ) ;
7272 case 'step' :
7373 this . handleStepStyles ( ) ;
7474 break ;
@@ -225,7 +225,7 @@ export class Slider extends FASTElement implements SliderConfiguration {
225225 */
226226 public get value ( ) : string {
227227 Observable . track ( this , 'value' ) ;
228- return this . _value . toString ( ) ;
228+ return this . _value ? .toString ( ) ?? '' ;
229229 }
230230
231231 public set value ( value : string ) {
@@ -245,7 +245,7 @@ export class Slider extends FASTElement implements SliderConfiguration {
245245 this . _value = value . toString ( ) ;
246246 this . elementInternals . ariaValueNow = this . _value ;
247247 this . elementInternals . ariaValueText = this . valueTextFormatter ( this . _value ) ;
248- this . setSliderPosition ( this . direction ) ;
248+ this . setSliderPosition ( ) ;
249249 this . $emit ( 'change' ) ;
250250 this . setFormValue ( value ) ;
251251 Observable . notify ( this , 'value' ) ;
@@ -303,6 +303,9 @@ export class Slider extends FASTElement implements SliderConfiguration {
303303 */
304304 @observable
305305 public direction : Direction = Direction . ltr ;
306+ public directionChanged ( ) : void {
307+ this . setSliderPosition ( ) ;
308+ }
306309
307310 /**
308311 * @internal
@@ -502,7 +505,7 @@ export class Slider extends FASTElement implements SliderConfiguration {
502505 swapStates ( this . elementInternals , prev , next , Orientation ) ;
503506
504507 if ( this . $fastController . isConnected ) {
505- this . setSliderPosition ( this . direction ) ;
508+ this . setSliderPosition ( ) ;
506509 }
507510 }
508511
@@ -536,7 +539,7 @@ export class Slider extends FASTElement implements SliderConfiguration {
536539 this . setupTrackConstraints ( ) ;
537540 this . setupListeners ( ) ;
538541 this . setupDefaultValue ( ) ;
539- this . setSliderPosition ( this . direction ) ;
542+ this . setSliderPosition ( ) ;
540543
541544 Observable . getNotifier ( this ) . subscribe ( this , 'max' ) ;
542545 Observable . getNotifier ( this ) . subscribe ( this , 'min' ) ;
@@ -629,18 +632,16 @@ export class Slider extends FASTElement implements SliderConfiguration {
629632
630633 /**
631634 * Places the thumb based on the current value
632- *
633- * @param direction - writing mode
634- */
635- private setSliderPosition ( direction : Direction ) : void {
636- const newPct : number = convertPixelToPercent ( parseFloat ( this . value ) , this . minAsNumber , this . maxAsNumber , direction ) ;
637- const percentage : number = ( 1 - newPct ) * 100 ;
638- const thumbPosition = `calc(100% - ${ percentage } %)` ;
639- const trackProgress =
640- ! ( this . orientation === Orientation . vertical ) && direction === Direction . rtl
641- ? `${ percentage } %`
642- : `calc(100% - ${ percentage } %)` ;
643- this . position = `--slider-thumb: ${ thumbPosition } ; --slider-progress: ${ trackProgress } ` ;
635+ */
636+ private setSliderPosition ( ) : void {
637+ const newPct : number = convertPixelToPercent (
638+ parseFloat ( this . value ) ,
639+ this . minAsNumber ,
640+ this . maxAsNumber ,
641+ this . direction ,
642+ ) ;
643+ const percentage : number = newPct * 100 ;
644+ this . position = `--slider-thumb: ${ percentage } %; --slider-progress: ${ percentage } %` ;
644645 }
645646
646647 /**
0 commit comments