mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +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 selectedId = undefined;
|
||||||
let inputRef = undefined;
|
let inputRef = undefined;
|
||||||
let inputValue = undefined;
|
let inputValue = '';
|
||||||
let highlightedIndex = -1;
|
let highlightedIndex = -1;
|
||||||
|
|
||||||
function change(direction) {
|
function change(direction) {
|
||||||
|
@ -57,14 +57,14 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$: selectedItem = items[selectedIndex];
|
|
||||||
$: inputValue = selectedItem ? selectedItem.text : undefined;
|
|
||||||
$: value = inputValue;
|
|
||||||
$: ariaLabel = $$props['aria-label'] || 'Choose an item';
|
$: ariaLabel = $$props['aria-label'] || 'Choose an item';
|
||||||
$: menuId = `menu-${id}`;
|
$: menuId = `menu-${id}`;
|
||||||
$: comboId = `combo-${id}`;
|
$: comboId = `combo-${id}`;
|
||||||
$: highlightedId = items[highlightedIndex] ? items[highlightedIndex].id : undefined;
|
$: highlightedId = items[highlightedIndex] ? items[highlightedIndex].id : undefined;
|
||||||
$: filteredItems = items.filter(item => shouldFilterItem(item, value));
|
$: filteredItems = items.filter(item => shouldFilterItem(item, value));
|
||||||
|
$: selectedItem = items[selectedIndex];
|
||||||
|
$: inputValue = selectedItem ? selectedItem.text : undefined;
|
||||||
|
$: value = inputValue;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:body
|
<svelte:body
|
||||||
|
@ -107,6 +107,7 @@
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
aria-autocomplete="list"
|
aria-autocomplete="list"
|
||||||
|
aria-expanded={open}
|
||||||
aria-activedescendant={highlightedId}
|
aria-activedescendant={highlightedId}
|
||||||
aria-labelledby={comboId}
|
aria-labelledby={comboId}
|
||||||
aria-disabled={disabled}
|
aria-disabled={disabled}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue