mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 20:33:02 +00:00
fix(combobox): filtered ComboBox handling with keyboard
This commit is contained in:
parent
3cadf2c001
commit
c8fe0b992b
1 changed files with 3 additions and 4 deletions
|
@ -113,10 +113,10 @@
|
||||||
|
|
||||||
function change(dir) {
|
function change(dir) {
|
||||||
let index = highlightedIndex + dir;
|
let index = highlightedIndex + dir;
|
||||||
|
let _items = !filteredItems?.length ? items : filteredItems;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index = items.length - 1;
|
index = _items.length - 1;
|
||||||
} else if (index >= items.length) {
|
} else if (index >= _items.length) {
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,6 @@
|
||||||
: undefined;
|
: undefined;
|
||||||
$: filteredItems = items.filter((item) => shouldFilterItem(item, value));
|
$: filteredItems = items.filter((item) => shouldFilterItem(item, value));
|
||||||
$: selectedItem = items[selectedIndex];
|
$: selectedItem = items[selectedIndex];
|
||||||
$: inputValue = selectedItem ? selectedItem.text : "";
|
|
||||||
$: value = inputValue;
|
$: value = inputValue;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue