@@ -66,6 +66,7 @@ import {
66
66
PlaceholderOptions
67
67
} from '../core/placeholder/placeholder-options' ;
68
68
import { Platform } from '@angular/cdk/platform' ;
69
+ import { HasTabIndex , mixinTabIndex } from '../core/common-behaviors/tabindex' ;
69
70
70
71
/**
71
72
* The following style constants are necessary to save here in order
@@ -155,7 +156,8 @@ export class MdSelectChange {
155
156
export class MdSelectBase {
156
157
constructor ( public _renderer : Renderer2 , public _elementRef : ElementRef ) { }
157
158
}
158
- export const _MdSelectMixinBase = mixinColor ( mixinDisabled ( MdSelectBase ) , 'primary' ) ;
159
+ export const _MdSelectMixinBase =
160
+ mixinTabIndex ( mixinColor ( mixinDisabled ( MdSelectBase ) , 'primary' ) ) ;
159
161
160
162
161
163
/**
@@ -172,7 +174,7 @@ export class MdSelectTrigger {}
172
174
selector : 'md-select, mat-select' ,
173
175
templateUrl : 'select.html' ,
174
176
styleUrls : [ 'select.css' ] ,
175
- inputs : [ 'color' , 'disabled' ] ,
177
+ inputs : [ 'color' , 'disabled' , 'tabIndex' ] ,
176
178
encapsulation : ViewEncapsulation . None ,
177
179
changeDetection : ChangeDetectionStrategy . OnPush ,
178
180
host : {
@@ -200,7 +202,7 @@ export class MdSelectTrigger {}
200
202
exportAs : 'mdSelect' ,
201
203
} )
202
204
export class MdSelect extends _MdSelectMixinBase implements AfterContentInit , OnDestroy , OnInit ,
203
- ControlValueAccessor , CanColor , CanDisable {
205
+ ControlValueAccessor , CanColor , CanDisable , HasTabIndex {
204
206
/** Whether or not the overlay panel is open. */
205
207
private _panelOpen = false ;
206
208
@@ -234,9 +236,6 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
234
236
/** The animation state of the placeholder. */
235
237
private _placeholderState = '' ;
236
238
237
- /** Tab index for the element. */
238
- private _tabIndex : number ;
239
-
240
239
/** Deals with configuring placeholder options */
241
240
private _placeholderOptions : PlaceholderOptions ;
242
241
@@ -371,15 +370,6 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
371
370
}
372
371
private _floatPlaceholder : FloatPlaceholderType ;
373
372
374
- /** Tab index for the select element. */
375
- @Input ( )
376
- get tabIndex ( ) : number { return this . disabled ? - 1 : this . _tabIndex ; }
377
- set tabIndex ( value : number ) {
378
- if ( typeof value !== 'undefined' ) {
379
- this . _tabIndex = value ;
380
- }
381
- }
382
-
383
373
/** Value of the select control. */
384
374
@Input ( )
385
375
get value ( ) { return this . _value ; }
@@ -445,7 +435,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
445
435
this . _control . valueAccessor = this ;
446
436
}
447
437
448
- this . _tabIndex = parseInt ( tabIndex ) || 0 ;
438
+ this . tabIndex = parseInt ( tabIndex ) || 0 ;
449
439
this . _placeholderOptions = placeholderOptions ? placeholderOptions : { } ;
450
440
this . floatPlaceholder = this . _placeholderOptions . float || 'auto' ;
451
441
}
0 commit comments