digipolisantwerp / antwerp-ui_angular

Antwerp UI is a component interface library for building user interfaces and responsive web apps.
https://digipolisantwerp.github.io/antwerp-ui_angular
MIT License
13 stars 19 forks source link

Autocomplete always selects first item if labels are identical #130

Closed jensCocquyt closed 5 years ago

jensCocquyt commented 5 years ago

Describe the bug

When the labels of 2 or more items in the list of the aui-autocomplete component are the same, the result of the onSelect handler will always be the first item, independently of which item is clicked. The labels are the same because we use a custom template for the aui-selectable-list.

To Reproduce

Steps to reproduce the behavior:

  1. Implement an aui-autocomplete with a custom template
  2. Use the aui-autocomplete component to search for a string and make sure the result is a list where 2 or more items have the same label (but a different visual label in the custom template).
  3. Select (click) the second item in the list.
  4. The result of the onSelect handler is the first item.

Expected behavior

The result of the onSelect handler is the item we actually clicked.

OS (please complete the following information):