@@ -99,7 +99,7 @@ export type MdSelectFloatPlaceholderType = 'always' | 'never' | 'auto';
99
99
encapsulation : ViewEncapsulation . None ,
100
100
host : {
101
101
'role' : 'listbox' ,
102
- '[attr.tabindex]' : '_getTabIndex() ' ,
102
+ '[attr.tabindex]' : 'tabIndex ' ,
103
103
'[attr.aria-label]' : 'placeholder' ,
104
104
'[attr.aria-required]' : 'required.toString()' ,
105
105
'[attr.aria-disabled]' : 'disabled.toString()' ,
@@ -151,6 +151,9 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
151
151
/** The animation state of the placeholder. */
152
152
private _placeholderState = '' ;
153
153
154
+ /** Tab index for the element. */
155
+ private _tabIndex : number = 0 ;
156
+
154
157
/**
155
158
* The width of the trigger. Must be saved to set the min width of the overlay panel
156
159
* and the width of the selected value.
@@ -266,6 +269,15 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
266
269
}
267
270
private _floatPlaceholder : MdSelectFloatPlaceholderType = 'auto' ;
268
271
272
+ /** Tab index for the select element. */
273
+ @Input ( )
274
+ get tabIndex ( ) : number { return this . _disabled ? - 1 : this . _tabIndex ; }
275
+ set tabIndex ( value : number ) {
276
+ if ( typeof value !== 'undefined' ) {
277
+ this . _tabIndex = value ;
278
+ }
279
+ }
280
+
269
281
/** Combined stream of all of the child options' change events. */
270
282
get optionSelectionChanges ( ) : Observable < MdOptionSelectionChange > {
271
283
return Observable . merge ( ...this . options . map ( option => option . onSelectionChange ) ) ;
@@ -452,12 +464,6 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
452
464
}
453
465
}
454
466
455
- /** Returns the correct tabindex for the select depending on disabled state. */
456
- _getTabIndex ( ) {
457
- return this . disabled ? '-1' : '0' ;
458
- }
459
-
460
-
461
467
/**
462
468
* Sets the scroll position of the scroll container. This must be called after
463
469
* the overlay pane is attached or the scroll container element will not yet be
0 commit comments