mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
fix(combobox): avoid runtime error if items
is empty (#1545)
This commit is contained in:
parent
948b5a1488
commit
09b3eed582
1 changed files with 1 additions and 0 deletions
|
@ -127,6 +127,7 @@
|
|||
function change(dir) {
|
||||
let index = highlightedIndex + dir;
|
||||
let _items = !filteredItems?.length ? items : filteredItems;
|
||||
if (_items.length === 0) return;
|
||||
if (index < 0) {
|
||||
index = _items.length - 1;
|
||||
} else if (index >= _items.length) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue