metonym / svelte-typeahead

Accessible, fuzzy search typeahead component
https://metonym.github.io/svelte-typeahead
MIT License
222 stars 18 forks source link

on:change is not triggered with option showAllResultsOnFocus #80

Open Artofaj opened 10 months ago

Artofaj commented 10 months ago

The component works as expected when used like this:

              <Typeahead
                label="Country"
                hideLabel
                limit={10}
                placeholder="Search Country"
                extract={(item) => item.NAME_0}
                data={regions0}
                bind:value={countrySelected}
                on:change={() => {
                console.log('expect an output')}
              >

With this I get the output expect an output

However, if I add the showAllResultsOnFocus like this:

              <Typeahead
                label="Country"
                hideLabel
                limit={10}
                placeholder="Search Country"
                extract={(item) => item.NAME_0}
                data={regions0}
                bind:value={countrySelected}
                on:change={() => {
                console.log('expect an output')}
               showAllResultsOnFocus
              >

I just get the expected output every other time.

Artofaj commented 10 months ago

Aparently 'every other time' is after clicking the delete button. Only then, the next input triggers the on:change.