Do not open autocomplete on clicking input
This commit is contained in:
parent
95806c5176
commit
63dc42cff6
@ -12,6 +12,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
export let autoClose: boolean | "inside" | "outside" = true;
|
||||
|
||||
export let placement = "bottom-start";
|
||||
export let toggleOpen = true;
|
||||
export let drop: "down" | "up" | "left" | "right" = "down";
|
||||
|
||||
$: dropClass = `drop${drop}`;
|
||||
@ -35,6 +36,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
/* avoid focusing element toggle on menu activation */
|
||||
toggle.focus = noop;
|
||||
|
||||
if (!toggleOpen) {
|
||||
/* do not open on clicking toggle */
|
||||
toggle.addEventListener = noop;
|
||||
}
|
||||
|
||||
dropdown = new Dropdown(toggle, {
|
||||
autoClose,
|
||||
popperConfig: (defaultConfig: Record<string, any>) => ({
|
||||
|
@ -122,7 +122,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
}
|
||||
</script>
|
||||
|
||||
<WithDropdown {drop} let:createDropdown>
|
||||
<WithDropdown {drop} toggleOpen={false} let:createDropdown>
|
||||
<slot createAutocomplete={createAutocomplete(createDropdown)} />
|
||||
|
||||
<DropdownMenu class={className}>
|
||||
|
Loading…
Reference in New Issue
Block a user