Choices
Choices copied to clipboard
When renderSelectedChoices set to 'always' for a multiple select, clicking a selected item should clear it
Describe the bug I think it is a bug that when renderSelectedChoices set to 'always' for a multiple select, clicking a selected item selects it again instead of toggling its selected state.
To Reproduce Steps to reproduce the behavior: use renderSelectedChoices set to always for a multiple select.
Expected behavior I expect clicking an element to unselect it
Desktop (please complete the following information):
- OS: [e.g. iOS] Windows 10
- Browser [e.g. chrome, safari] Chrome
- Version [e.g. 22] Latest
If you agree it's a bug I'll put in a PR. Otherwise I'll code around it for my needs.
I ran into the same problem and found a workaround like this:
@Listen('choice')
removeAlreadySelected(e: CustomEvent) {
if (e.detail.choice.selected && this.type === 'multiple') {
setTimeout(() => { this.removeActiveItemsByValue(e.detail.choice.value)
}, 100)
}
}