mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-21 04:39:19 +00:00
feat(combo-box): add option to clear accessor to not re-focus input
Closes #994
This commit is contained in:
parent
1a470cb331
commit
93317fc5de
1 changed files with 3 additions and 3 deletions
|
@ -126,9 +126,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the combo box programmatically
|
* Clear the combo box programmatically
|
||||||
* @type {() => void}
|
* @type {(options?: { focus?: boolean; }) => void}
|
||||||
*/
|
*/
|
||||||
export function clear() {
|
export function clear(options = {}) {
|
||||||
prevSelectedIndex = undefined;
|
prevSelectedIndex = undefined;
|
||||||
selectedIndex = -1;
|
selectedIndex = -1;
|
||||||
highlightedIndex = -1;
|
highlightedIndex = -1;
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
selectedItem = undefined;
|
selectedItem = undefined;
|
||||||
open = false;
|
open = false;
|
||||||
inputValue = "";
|
inputValue = "";
|
||||||
ref?.focus();
|
if (options?.focus !== false) ref?.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
afterUpdate(() => {
|
afterUpdate(() => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue