rob-balfre / svelte-select

Svelte Select. A select component for Svelte
https://svelte-select-examples.vercel.app
Other
1.27k stars 180 forks source link

CloseListOnChange prop is ignored when using the list slot. #596

Open iandoesallthethings opened 1 year ago

iandoesallthethings commented 1 year ago

I'm using the list slot for some custom styling, but setting closeListOnChange to true doesn't do anything when I do this.

<Select
  {items}
  bind:value
  closeListOnChange={true}
>
  <div slot="list" let:filteredItems>
    <Button on:click={() => setValue(item)}>
      {item.label}
    </Button>
  </div>
</Select>

So far, my solution is to bind:focused and set it to false in setValue(), but it would be nice if just passing in the prop worked or if Select exposed its own close() method.

rob-balfre commented 1 year ago

Can't you just use the item slot instead?

On Fri, 5 May 2023, 6:23 am Ian, @.***> wrote:

I'm using the list slot for some custom styling, but setting closeListOnChange to true doesn't do anything when I do this.

<Select {items} bind:value closeListOnChange={true}

So far, my solution is to bind:focused and set it to false in setValue(), but it would be nice if just passing in the prop worked or if Select exposed its own close() method.

— Reply to this email directly, view it on GitHub https://github.com/rob-balfre/svelte-select/issues/596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUAM7WGWY3P73CZYKBS2S3XEQF3PANCNFSM6AAAAAAXWIJ5MY . You are receiving this because you are subscribed to this thread.Message ID: @.***>