fix(dropdown): avoid runtime error if items is empty

This commit is contained in:
Eric Liu 2022-12-07 20:35:05 -08:00
commit a0f7b4c90a

View file

@ -121,6 +121,7 @@
function change(dir) {
let index = highlightedIndex + dir;
if (items.length === 0) return;
if (index < 0) {
index = items.length - 1;
} else if (index >= items.length) {