Vue-select: Optional remove of already selected results

Created on 10 Mar 2016  Â·  7Comments  Â·  Source: sagalbot/vue-select

It would be handy to remove already selected items from the list in case of a similar search.

wontfix

Most helpful comment

Thanks @colinbes I managed to "remove" the item from the list by adding display: none; to .vs__dropdown-option--selected. Winner!

All 7 comments

I think hiding already selected items may be more confusing to users than leaving them in the list. This behaviour isn't implemented in Select2, so I don't think I'll be adding that one. I'd like to keep the list of props as short and succinct as possible.

You're absolutely entitled to make that choice. That's why I suggested it could be optional.

I'm migrating a project to Vue.js and this option is _absolutely_ mandatory for it. I figure it would be for others, like in the example you choose: nobody wants to have the same country selected twice, nor anyone I know would want selecting a country twice would _remove_ it.

And I can't have my users to guess that re-selecting it will remove it – which, as I said, is totally counter-intuitive – because they're used to the contrary (as anybody else?).

And my users know that when they validate something, it will be saved to the database – whatever it is, but not the _absence_ of it.

Keeping your props dry, in that regard, is killing a basic interaction everybody is used to.

@gemp Just to be clear, I think you're totally right that clicking/return on an already selected item should just close the list, not unselect the option. I will implement that ASAP.

As far as hiding options from the dropdown that are currently selected, neither Select2 nor Chosen hide items from the list. With these two being the most popular out there, I don't think that hiding items is an interaction that people are used to. Select2 just displays them as active, and selecting it just closes the dropdown without changing the selection.

Chosen handles it a bit differently, by still displaying the list item, but providing UI clues that it's disabled. You can't select it using up/down arrows or with your mouse.
screen shot 2016-03-10 at 2 37 04 pm
Would that approach work for you?

Would that approach work for you?

That would be a clean compromise. And I think I could always then manage a CSS rule that could hide it if I wanted to (or something). It's a better solution than hiding it completely. Very good thinking, thanks.

Was this 'chosen' functionality ever included? I am also looking to either filter out already chosen option items (which I have working) or use 'chosen' class to indicate item already selected.

For those looking as well - Spent time digging through code and found the class .vs__dropdown-option--selected added to items already selected.

Thanks @colinbes I managed to "remove" the item from the list by adding display: none; to .vs__dropdown-option--selected. Winner!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edalzell picture edalzell  Â·  3Comments

theseawolves picture theseawolves  Â·  4Comments

xuwenhao picture xuwenhao  Â·  3Comments

rudykaze picture rudykaze  Â·  3Comments

FrozenIce0617 picture FrozenIce0617  Â·  3Comments