vue-select: option:deselected and option:deselecting are not getting emitted
Describe the bug
Hello there! I’ve installed the latest version of vue-select (3.11.2, but also tried 3.11.1), and it seems like the two deselection events do not get emitted.
To Reproduce
<vue-select
:searchable="false"
:options="options"
:value="value"
:reduce="option => option.value"
@input="$emit('input', $event)"
@option:selected="$emit('select')"
@option:deselected="$emit('select')" />
Expected behavior
option:deselected should get fired. As you can see in my screenshot, the two selecting and selected events do get fired, but not deselection ones (corresponding to the last input event you see). I’ve also tried with option:deselecting, and it also doesn’t work.
Screenshots

About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 6
- Comments: 15
Commits related to this issue
- fix: option:deselected and option:deselecting are not getting emitted (#1430) — committed to DmitryShlepkin/vue-select by DmitryShlepkin 2 years ago
- fix: option:deselected and option:deselecting are not getting emitted (#1430) — committed to DmitryShlepkin/vue-select by DmitryShlepkin 2 years ago
- fix: option:deselected and option:deselecting are not getting emitted (#1430) — committed to DmitryShlepkin/vue-select by DmitryShlepkin 2 years ago
Using
@update:modelValueworked for me. That seems to fire both when selecting and deselecting items.After a small investigation, the problems comes from the fact that clicking on the “clear selection” button doesn’t call the same method (
clearSelection()) as when you deselect an option in a multiple select (deselect()). Theoption:deselect(ing|ed)events get only emitted in thedeselect()method, and they get passed the deselected option as parameter.I would say that technically it’s not a bug, as “clearing selection” is not the same as “deselecting something”. But if we have
option:selectedthen I think that we must also haveoption:deselected.This would mean adding two
$emitin theclearSelectionmethod, maybe with no parameter?How could you explain? I am not able to handle callback of @input on single selects. I am using Vue-Select 4.0.0-beta.2