@@ -84,7 +84,7 @@ export type MdSelectFloatPlaceholderType = 'always' | 'never' | 'auto';
84
84
encapsulation : ViewEncapsulation . None ,
85
85
host : {
86
86
'role' : 'listbox' ,
87
- '[attr.tabindex]' : '_getTabIndex() ' ,
87
+ '[attr.tabindex]' : 'tabIndex ' ,
88
88
'[attr.aria-label]' : 'placeholder' ,
89
89
'[attr.aria-required]' : 'required.toString()' ,
90
90
'[attr.aria-disabled]' : 'disabled.toString()' ,
@@ -133,6 +133,9 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
133
133
/** The animation state of the placeholder. */
134
134
private _placeholderState = '' ;
135
135
136
+ /** Tab index for the element. */
137
+ private _tabIndex : number = 0 ;
138
+
136
139
/**
137
140
* The width of the trigger. Must be saved to set the min width of the overlay panel
138
141
* and the width of the selected value.
@@ -237,6 +240,15 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
237
240
}
238
241
private _floatPlaceholder : MdSelectFloatPlaceholderType = 'auto' ;
239
242
243
+ /** Tab index for the select element. */
244
+ @Input ( )
245
+ get tabIndex ( ) : number { return this . _disabled ? - 1 : this . _tabIndex ; }
246
+ set tabIndex ( value : number ) {
247
+ if ( typeof value !== 'undefined' ) {
248
+ this . _tabIndex = value ;
249
+ }
250
+ }
251
+
240
252
/** Event emitted when the select has been opened. */
241
253
@Output ( ) onOpen : EventEmitter < void > = new EventEmitter < void > ( ) ;
242
254
@@ -407,12 +419,6 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
407
419
}
408
420
}
409
421
410
- /** Returns the correct tabindex for the select depending on disabled state. */
411
- _getTabIndex ( ) {
412
- return this . disabled ? '-1' : '0' ;
413
- }
414
-
415
-
416
422
/**
417
423
* Sets the scroll position of the scroll container. This must be called after
418
424
* the overlay pane is attached or the scroll container element will not yet be
0 commit comments