Skip to content

Commit 968fe4a

Browse files
committed
Fix bug in input-select
1 parent de67709 commit 968fe4a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/pg/menu/menu.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ export default class PgMenu extends HTMLElement {
6161
}
6262

6363
focus(index) {
64-
const item = this.$items.children[index] as HTMLElement;
65-
item?.focus();
64+
if (index === -1) {
65+
this.#focus(0, 1, this.items.length - 1);
66+
} else {
67+
const item = this.$items.children[index] as HTMLElement;
68+
item?.focus();
69+
}
6670
}
6771

6872
/**

0 commit comments

Comments
 (0)