mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
chore(combo-box): initialize inputValue with empty string
This commit is contained in:
parent
138f672ae4
commit
b0be811d8b
1 changed files with 5 additions and 4 deletions
|
@ -32,7 +32,7 @@
|
|||
|
||||
let selectedId = undefined;
|
||||
let inputRef = undefined;
|
||||
let inputValue = undefined;
|
||||
let inputValue = '';
|
||||
let highlightedIndex = -1;
|
||||
|
||||
function change(direction) {
|
||||
|
@ -57,14 +57,14 @@
|
|||
}
|
||||
});
|
||||
|
||||
$: selectedItem = items[selectedIndex];
|
||||
$: inputValue = selectedItem ? selectedItem.text : undefined;
|
||||
$: value = inputValue;
|
||||
$: ariaLabel = $$props['aria-label'] || 'Choose an item';
|
||||
$: menuId = `menu-${id}`;
|
||||
$: comboId = `combo-${id}`;
|
||||
$: highlightedId = items[highlightedIndex] ? items[highlightedIndex].id : undefined;
|
||||
$: filteredItems = items.filter(item => shouldFilterItem(item, value));
|
||||
$: selectedItem = items[selectedIndex];
|
||||
$: inputValue = selectedItem ? selectedItem.text : undefined;
|
||||
$: value = inputValue;
|
||||
</script>
|
||||
|
||||
<svelte:body
|
||||
|
@ -107,6 +107,7 @@
|
|||
tabindex="0"
|
||||
autocomplete="off"
|
||||
aria-autocomplete="list"
|
||||
aria-expanded={open}
|
||||
aria-activedescendant={highlightedId}
|
||||
aria-labelledby={comboId}
|
||||
aria-disabled={disabled}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue