Skip to content

Commit f2c65aa

Browse files
committed
Fix active item highlighting problems
1 parent 1c06985 commit f2c65aa

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

src/renderer/components/GroupedList.vue

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,27 @@
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() {

0 commit comments

Comments
 (0)