File tree 5 files changed +13
-9
lines changed
5 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ export class ListItemEl extends LitElement implements ListItem {
105
105
* so that we have control over focus on specific variants such as disabling
106
106
* focus on <md-autocomplete-item> but enabling it for <md-menu-item>.
107
107
*/
108
- protected focusOnSelection = true ;
108
+ protected focusOnActivation = true ;
109
109
110
110
protected getRipple = ( ) => {
111
111
this . showRipple = true ;
@@ -119,7 +119,7 @@ export class ListItemEl extends LitElement implements ListItem {
119
119
if ( this . active ) {
120
120
this . itemTabIndex = 0 ;
121
121
122
- if ( this . focusOnSelection ) {
122
+ if ( this . focusOnActivation ) {
123
123
this . showFocusRing = shouldShowStrongFocus ( ) ;
124
124
}
125
125
@@ -274,7 +274,7 @@ export class ListItemEl extends LitElement implements ListItem {
274
274
// will focus the list item root if it is selected but not on the first
275
275
// update or else it may cause the page to jump on first load.
276
276
if ( changed . has ( 'active' ) && ! this . isFirstUpdate && this . active &&
277
- this . focusOnSelection ) {
277
+ this . focusOnActivation ) {
278
278
this . focus ( ) ;
279
279
}
280
280
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ export abstract class Menu extends LitElement {
133
133
*/
134
134
@ariaProperty
135
135
@property ( { attribute : 'data-role' , noAccessor : true } )
136
- override role : ARIARole = 'list ' ;
136
+ override role : ARIARole = 'menu ' ;
137
137
/**
138
138
* The max time between the keystrokes of the typeahead menu behavior before
139
139
* it clears the typeahead buffer.
@@ -664,6 +664,7 @@ export abstract class Menu extends LitElement {
664
664
const items = this . items ;
665
665
for ( const item of items ) {
666
666
item . active = false ;
667
+ item . selected = false ;
667
668
}
668
669
}
669
670
Original file line number Diff line number Diff line change @@ -15,10 +15,14 @@ interface MenuItemSelf {
15
15
*/
16
16
headline : string ;
17
17
/**
18
- * Whether or not the item is in the selected visual state (focuses on
19
- * selection ).
18
+ * Whether or not the item is the currently active item of interest (focuses
19
+ * upon activation ).
20
20
*/
21
21
active : boolean ;
22
+ /**
23
+ * Whether or not the item is in the selected visual state.
24
+ */
25
+ selected ?: boolean ;
22
26
/**
23
27
* If it is a sub-menu-item, a method that can close the submenu.
24
28
*/
Original file line number Diff line number Diff line change @@ -217,7 +217,6 @@ export class SubMenuItem extends MenuItemEl {
217
217
// around the menu and then mouses over an md-sub-menu.
218
218
this . dispatchEvent ( new DeactivateItemsEvent ( ) ) ;
219
219
this . dispatchEvent ( new DeactivateTypeaheadEvent ( ) ) ;
220
- this . active = true ;
221
220
this . selected = true ;
222
221
223
222
// This is the case of mouse hovering when already opened via keyboard or
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export class SelectOptionEl extends MenuItemEl implements SelectOption {
42
42
// By default active = true focuses the element. We want to prevent that
43
43
// in this case because we set active = this.selected and that may mess
44
44
// around with menu's restore focus function once the menu closes.
45
- this . focusOnSelection = false ;
45
+ this . focusOnActivation = false ;
46
46
}
47
47
48
48
super . willUpdate ( changed ) ;
@@ -52,7 +52,7 @@ export class SelectOptionEl extends MenuItemEl implements SelectOption {
52
52
super . updated ( changed ) ;
53
53
// Restore the active = true focusing behavior which happens in
54
54
// super.updated() if it was turned off.
55
- this . focusOnSelection = true ;
55
+ this . focusOnActivation = true ;
56
56
57
57
// Do not dispatch event on first update / boot-up.
58
58
if ( changed . has ( 'selected' ) && changed . get ( 'selected' ) !== undefined ) {
You can’t perform that action at this time.
0 commit comments