GithubHelp home page GithubHelp logo

Comments (7)

LewisYoul avatar LewisYoul commented on August 24, 2024 6

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

from vue-select.

colinbes avatar colinbes commented on August 24, 2024 2

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

from vue-select.

gemp avatar gemp commented on August 24, 2024 1

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.

from vue-select.

gemp avatar gemp commented on August 24, 2024 1

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.

from vue-select.

sagalbot avatar sagalbot commented on August 24, 2024

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.

from vue-select.

sagalbot avatar sagalbot commented on August 24, 2024

@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?

from vue-select.

colinbes avatar colinbes commented on August 24, 2024

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.

from vue-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.