@@ -101,7 +101,8 @@ export type MdSelectFloatPlaceholderType = 'always' | 'never' | 'auto';
101
101
host : {
102
102
'role' : 'listbox' ,
103
103
'[attr.tabindex]' : 'tabIndex' ,
104
- '[attr.aria-label]' : 'placeholder' ,
104
+ '[attr.aria-label]' : '_ariaLabel' ,
105
+ '[attr.aria-labelledby]' : 'ariaLabelledby' ,
105
106
'[attr.aria-required]' : 'required.toString()' ,
106
107
'[attr.aria-disabled]' : 'disabled.toString()' ,
107
108
'[attr.aria-invalid]' : '_control?.invalid || "false"' ,
@@ -279,6 +280,12 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
279
280
}
280
281
}
281
282
283
+ /** Aria label of the select. If not specified, the placeholder will be used as label. */
284
+ @Input ( 'aria-label' ) ariaLabel : string = '' ;
285
+
286
+ /** Input that can be used to specify the `aria-labelledby` attribute. */
287
+ @Input ( 'aria-labelledby' ) ariaLabelledby : string = '' ;
288
+
282
289
/** Combined stream of all of the child options' change events. */
283
290
get optionSelectionChanges ( ) : Observable < MdOptionSelectionChange > {
284
291
return Observable . merge ( ...this . options . map ( option => option . onSelectionChange ) ) ;
@@ -747,6 +754,13 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
747
754
'visible' : 'hidden' ;
748
755
}
749
756
757
+ /** Returns the aria-label of the select component. */
758
+ get _ariaLabel ( ) : string {
759
+ // If a ariaLabelledby value has been set, the select should not overwrite the
760
+ // `aria-labelledby` value by setting the ariaLabel to the placeholder.
761
+ return this . ariaLabelledby ? null : this . ariaLabel || this . placeholder ;
762
+ }
763
+
750
764
/**
751
765
* Calculates the y-offset of the select's overlay panel in relation to the
752
766
* top start corner of the trigger. It has to be adjusted in order for the
0 commit comments