Code Monkey home page Code Monkey logo

Comments (4)

libdev-hacker avatar libdev-hacker commented on June 7, 2024 1

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

from skeleton.

endigo9740 avatar endigo9740 commented on June 7, 2024

@libdev-hacker this is a fairly complex combination of features. A minimal reproduction would be welcome please.

from skeleton.

libdev-hacker avatar libdev-hacker commented on June 7, 2024

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}

from skeleton.

endigo9740 avatar endigo9740 commented on June 7, 2024

@libdev-hacker thanks for the snippet. Unfortunately it looks like onSelection() was not included in your code. This is a function you should be defining and handling, 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:

Screenshot 2024-05-13 at 3 56 26 PM

Alternatively, if you're not using the on:selection, just prune it from the component.

from skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.