Fix Input Dropdown Outside Click (#8404)
This commit is contained in:
parent
94f4ed5604
commit
77165e4cdd
|
@ -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