fix: search clear when value is ''

This commit is contained in:
Arman committed 2022-07-28 11:49:13 +02:00
1 parent 4e17591c39
commit 69f285162f
1 file changed
+8 -1
+8 -1
View File
@@ -1,4 +1,6 @@
<script lang="ts">
import { browser } from '$app/env';
import { onMount } from 'svelte';
export let value = '';
@@ -25,6 +27,12 @@
value = target.value;
}, debounce);
};
$: if (!value) {
if (element) {
element.value = value;
}
}
</script>
<div class="input-text-wrapper" class:is-with-end-button={isWithEndButton}>
@@ -43,7 +51,6 @@
aria-label="Clear search"
on:click={() => {
value = '';
element.value = value;
}}>
<span class="icon-x" aria-hidden="true" />
</button>