@@ -20,6 +20,7 @@ import {
2020 UP_ARROW ,
2121} from '@angular/cdk/keycodes' ;
2222import {
23+ Attribute ,
2324 ChangeDetectionStrategy ,
2425 ChangeDetectorRef ,
2526 Component ,
@@ -40,8 +41,10 @@ import {
4041 CanColor ,
4142 CanDisable ,
4243 HammerInput ,
44+ HasTabIndex ,
4345 mixinColor ,
4446 mixinDisabled ,
47+ mixinTabIndex ,
4548} from '@angular/material/core' ;
4649import { Subscription } from 'rxjs/Subscription' ;
4750
@@ -85,7 +88,8 @@ export class MatSliderChange {
8588export class MatSliderBase {
8689 constructor ( public _renderer : Renderer2 , public _elementRef : ElementRef ) { }
8790}
88- export const _MatSliderMixinBase = mixinColor ( mixinDisabled ( MatSliderBase ) , 'accent' ) ;
91+ export const _MatSliderMixinBase =
92+ mixinTabIndex ( mixinColor ( mixinDisabled ( MatSliderBase ) , 'accent' ) ) ;
8993
9094/**
9195 * Allows users to select from a range of values by moving the slider thumb. It is similar in
@@ -108,7 +112,7 @@ export const _MatSliderMixinBase = mixinColor(mixinDisabled(MatSliderBase), 'acc
108112 '(slidestart)' : '_onSlideStart($event)' ,
109113 'class' : 'mat-slider' ,
110114 'role' : 'slider' ,
111- 'tabindex ' : '0 ' ,
115+ '[tabIndex] ' : 'tabIndex ' ,
112116 '[attr.aria-disabled]' : 'disabled' ,
113117 '[attr.aria-valuemax]' : 'max' ,
114118 '[attr.aria-valuemin]' : 'min' ,
@@ -126,13 +130,13 @@ export const _MatSliderMixinBase = mixinColor(mixinDisabled(MatSliderBase), 'acc
126130 } ,
127131 templateUrl : 'slider.html' ,
128132 styleUrls : [ 'slider.css' ] ,
129- inputs : [ 'disabled' , 'color' ] ,
133+ inputs : [ 'disabled' , 'color' , 'tabIndex' ] ,
130134 encapsulation : ViewEncapsulation . None ,
131135 preserveWhitespaces : false ,
132136 changeDetection : ChangeDetectionStrategy . OnPush ,
133137} )
134138export class MatSlider extends _MatSliderMixinBase
135- implements ControlValueAccessor , OnDestroy , CanDisable , CanColor , OnInit {
139+ implements ControlValueAccessor , OnDestroy , CanDisable , CanColor , OnInit , HasTabIndex {
136140 /** Whether the slider is inverted. */
137141 @Input ( )
138142 get invert ( ) { return this . _invert ; }
@@ -418,8 +422,11 @@ export class MatSlider extends _MatSliderMixinBase
418422 elementRef : ElementRef ,
419423 private _focusMonitor : FocusMonitor ,
420424 private _changeDetectorRef : ChangeDetectorRef ,
421- @Optional ( ) private _dir : Directionality ) {
425+ @Optional ( ) private _dir : Directionality ,
426+ @Attribute ( 'tabindex' ) tabIndex : string ) {
422427 super ( renderer , elementRef ) ;
428+
429+ this . tabIndex = parseInt ( tabIndex ) || 0 ;
423430 }
424431
425432 ngOnInit ( ) {
0 commit comments