Fix Input Dropdown Outside Click (#8404)
This commit is contained in:
parent
50f0a0509d
commit
9e5d39e3ff
|
@ -102,6 +102,13 @@
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleOutsideClick = event => {
|
||||||
|
if (open) {
|
||||||
|
event.stopPropagation()
|
||||||
|
open = false
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
@ -151,7 +158,7 @@
|
||||||
{disabled}
|
{disabled}
|
||||||
class:is-open={open}
|
class:is-open={open}
|
||||||
aria-haspopup="listbox"
|
aria-haspopup="listbox"
|
||||||
on:mousedown={onClick}
|
on:click={onClick}
|
||||||
>
|
>
|
||||||
<span class="spectrum-Picker-label">
|
<span class="spectrum-Picker-label">
|
||||||
<div>
|
<div>
|
||||||
|
@ -168,7 +175,7 @@
|
||||||
</button>
|
</button>
|
||||||
{#if open}
|
{#if open}
|
||||||
<div
|
<div
|
||||||
use:clickOutside={() => (open = false)}
|
use:clickOutside={handleOutsideClick}
|
||||||
transition:fly|local={{ y: -20, duration: 200 }}
|
transition:fly|local={{ y: -20, duration: 200 }}
|
||||||
class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
|
class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue