File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 };
3737 },
3838 updated () {
39- // Set the first item in the list to be active
40- const listElement = this .$el .getElementsByTagName (" li" )[0 ];
39+ // Reset the active items
40+ const listElements = this .$el .getElementsByTagName (" li" );
41+ for (const el of listElements) {
42+ el .classList .remove (" active" );
43+ el .tabIndex = - 1 ;
44+ }
4145
42- if (! listElement) {
43- return ;
44- }
46+ // Set the first item in the list to be active
47+ const listElement = listElements[0 ];
4548
46- listElement .tabIndex = 0 ;
47- listElement .classList .add (" active" );
49+ if (! listElement) {
50+ return ;
51+ }
4852
53+ listElement .tabIndex = 0 ;
54+ listElement .classList .add (" active" );
55+ listElement .scrollIntoView ();
56+ this .$root .$el .getElementsByTagName (" input" )[0 ].focus ();
4957
50- this .activeItemIndex = 0 ;
51- this .$emit (" active" , this .items [this .activeItemIndex ]);
58+ this .activeItemIndex = 0 ;
59+ this .$emit (" active" , this .items [this .activeItemIndex ]);
5260 },
5361 computed: {
5462 groupedItems () {
You can’t perform that action at this time.
0 commit comments