diff --git a/src/ComboBox/ComboBox.svelte b/src/ComboBox/ComboBox.svelte index 2486a72e..9576206d 100644 --- a/src/ComboBox/ComboBox.svelte +++ b/src/ComboBox/ComboBox.svelte @@ -126,9 +126,9 @@ /** * Clear the combo box programmatically - * @type {() => void} + * @type {(options?: { focus?: boolean; }) => void} */ - export function clear() { + export function clear(options = {}) { prevSelectedIndex = undefined; selectedIndex = -1; highlightedIndex = -1; @@ -137,7 +137,7 @@ selectedItem = undefined; open = false; inputValue = ""; - ref?.focus(); + if (options?.focus !== false) ref?.focus(); } afterUpdate(() => {