@@ -202,9 +202,11 @@ function SelectDirective($mdSelect, $mdUtil, $mdConstant, $mdTheming, $mdAria, $
202
202
}
203
203
204
204
// There's got to be an md-content inside. If there's not one, let's add it.
205
- if ( ! element . find ( 'md-content' ) . length ) {
205
+ var mdContentEl = element . find ( 'md-content' ) ;
206
+ if ( ! mdContentEl . length ) {
206
207
element . append ( angular . element ( '<md-content>' ) . append ( element . contents ( ) ) ) ;
207
208
}
209
+ mdContentEl . attr ( 'role' , 'presentation' ) ;
208
210
209
211
210
212
// Add progress spinner for md-options-loading
@@ -258,8 +260,8 @@ function SelectDirective($mdSelect, $mdUtil, $mdConstant, $mdTheming, $mdAria, $
258
260
// Use everything that's left inside element.contents() as the contents of the menu
259
261
var multipleContent = isMultiple ? 'multiple' : '' ;
260
262
var selectTemplate = '' +
261
- '<div class="md-select-menu-container" aria-hidden="true">' +
262
- '<md-select-menu {0}>{1}</md-select-menu>' +
263
+ '<div class="md-select-menu-container" aria-hidden="true" role="presentation" >' +
264
+ '<md-select-menu role="presentation" {0}>{1}</md-select-menu>' +
263
265
'</div>' ;
264
266
265
267
selectTemplate = $mdUtil . supplant ( selectTemplate , [ multipleContent , element . html ( ) ] ) ;
@@ -521,7 +523,10 @@ function SelectDirective($mdSelect, $mdUtil, $mdConstant, $mdTheming, $mdAria, $
521
523
522
524
var containerId = 'select_container_' + $mdUtil . nextUid ( ) ;
523
525
selectContainer . attr ( 'id' , containerId ) ;
524
- ariaAttrs [ 'aria-owns' ] = containerId ;
526
+ // Only add aria-owns if element ownership is NOT represented in the DOM.
527
+ if ( ! element . find ( 'md-select-menu' ) . length ) {
528
+ ariaAttrs [ 'aria-owns' ] = containerId ;
529
+ }
525
530
element . attr ( ariaAttrs ) ;
526
531
527
532
scope . $on ( '$destroy' , function ( ) {
@@ -1075,6 +1080,7 @@ function OptgroupDirective() {
1075
1080
el . prepend ( labelElement ) ;
1076
1081
}
1077
1082
labelElement . addClass ( 'md-container-ignore' ) ;
1083
+ labelElement . attr ( 'aria-hidden' , 'true' ) ;
1078
1084
if ( attrs . label ) labelElement . text ( attrs . label ) ;
1079
1085
}
1080
1086
}
@@ -1149,6 +1155,7 @@ function SelectProvider($$interimElementProvider) {
1149
1155
. removeClass ( 'md-active' )
1150
1156
. attr ( 'aria-hidden' , 'true' )
1151
1157
. css ( 'display' , 'none' ) ;
1158
+ element . parent ( ) . find ( 'md-select-value' ) . removeAttr ( 'aria-hidden' ) ;
1152
1159
1153
1160
announceClosed ( opts ) ;
1154
1161
@@ -1175,6 +1182,7 @@ function SelectProvider($$interimElementProvider) {
1175
1182
opts . alreadyOpen = true ;
1176
1183
opts . cleanupInteraction = activateInteraction ( ) ;
1177
1184
opts . cleanupResizing = activateResizing ( ) ;
1185
+ autoFocus ( opts . focusedNode ) ;
1178
1186
1179
1187
return response ;
1180
1188
} , opts . hideBackdrop ) ;
@@ -1188,6 +1196,11 @@ function SelectProvider($$interimElementProvider) {
1188
1196
* and scalings...
1189
1197
*/
1190
1198
function showDropDown ( scope , element , opts ) {
1199
+ if ( opts . parent !== element . parent ( ) ) {
1200
+ element . parent ( ) . attr ( 'aria-owns' , element . attr ( 'id' ) ) ;
1201
+ }
1202
+ element . parent ( ) . find ( 'md-select-value' ) . attr ( 'aria-hidden' , 'true' ) ;
1203
+
1191
1204
opts . parent . append ( element ) ;
1192
1205
1193
1206
return $q ( function ( resolve , reject ) {
@@ -1208,7 +1221,7 @@ function SelectProvider($$interimElementProvider) {
1208
1221
1209
1222
/**
1210
1223
* Initialize container and dropDown menu positions/scale, then animate
1211
- * to show... and autoFocus.
1224
+ * to show.
1212
1225
*/
1213
1226
function positionAndFocusMenu ( ) {
1214
1227
return $q ( function ( resolve ) {
@@ -1223,7 +1236,6 @@ function SelectProvider($$interimElementProvider) {
1223
1236
element . addClass ( 'md-active' ) ;
1224
1237
info . dropDown . element . css ( animator . toCss ( { transform : '' } ) ) ;
1225
1238
1226
- autoFocus ( opts . focusedNode ) ;
1227
1239
resolve ( ) ;
1228
1240
} ) ;
1229
1241
0 commit comments