Skip to content
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

When selecting an autocomplete suggestion with the mouse, component.selected is not (always) set #16

Open
woutervanvliet opened this issue Aug 22, 2024 · 0 comments · May be fixed by #17
Assignees

Comments

@woutervanvliet
Copy link

Steps to reproduce:

  1. Enter a partial address that results in multiple autocomplete suggestions in the address field (for example: Provstejorden 3)
  2. Use the mouse to select any of the options (for example: Provstejorden 30, 9000 Aalborg)
  3. Observe that the "select" callback is called
  4. Observe that "component.selected()" keeps it's original value
  5. Clicking in the field again, then selecting the only suggested option will update the components internal selected state

The following modification to the first autocomplete control on the demo page makes it clear to see:

 const component = dawaAutocomplete.dawaAutocomplete(document.getElementById("adresse"), {
    select: function(selected) {
    document.getElementById("valgtadresse").innerHTML= selected.tekst;
      console.log('Selected address: -- ', this);
      console.dir(selected);
      console.log('selected', component.selected())
    }
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants