-
-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocomplete 'on:selection' Event never triggers when inside of a Modal #2654
Comments
@libdev-hacker this is a fairly complex combination of features. A minimal reproduction would be welcome please. |
Here is a video showing the issue (I apologise for the zip archive): autocomplete-in-modalzip.zip Here is an example of how I'm trying to use these features: <script lang='ts'>
const modalStore: ModalStore = getModalStore();
var autocomplete: AutocompleteOption<string>[] = [
{ label: "Test", value: "test" }
];
let input: string = "";
export let parent: SvelteComponent;
</script>
{#if $modalStore[0]}
<div id="modal" class="bg-slate-800 grid grid-cols-1 grid-rows-2 grid-flow-col justify-items-center rounded-lg w-modal h-56 relative bottom-48">
<div>
<input class="input w-96 max-w-sm max-h-12 mb-2" bind:value={input} type="text" placeholder="Search..." />
<div class="card w-full max-w-sm max-h-48 p-4 overflow-y-auto" tabindex="-1">
<Autocomplete bind:input={input} options={autocomplete} on:selection={onSelection}/>
</div>
</div>
</div>
{/if} |
@libdev-hacker thanks for the snippet. Unfortunately it looks like function onSelection(event) {
console.log(event.detail);
} <Autocomplete ... on:selection={onSelection}/> This is not well explained in the docs, but is present in the documentation for the main demo at the top of the page. Just tap the Code view, then you'll see this: Alternatively, if you're not using the |
Hi, Thanks for pointing that out to me, I'm sure you'd be happy to know that it now works. Thanks for all your help & support |
Current Behavior
When implementing an Autocomplete component inside of a Modal, the selection event never gets fired, meaning that the inside value of the input never changes when selecting one of the options within the component
Expected Behavior
The selection event gets fired & the value within the input gets updated
Steps To Reproduce
<input class="input w-96 max-w-sm max-h-12 mb-2" bind:value={input} type="text" placeholder="Search..."/>
<Autocomplete bind:input={input} options={Autocomplete} on:selection={onSelection}/>
Link to Reproduction / Stackblitz
No response
More Information
No response
The text was updated successfully, but these errors were encountered: