Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to disable clear selection. #82

Closed
microtheta opened this issue Nov 6, 2016 · 5 comments
Closed

No way to disable clear selection. #82

microtheta opened this issue Nov 6, 2016 · 5 comments

Comments

@microtheta
Copy link

When you select an option and after that if you select the same option, it will deselect it. This is intuitive and may be useful in most of the cases.
But In other cases we'll always need to have a selected option. I.e. we can not allow user to deselect the option as we may update the lot of UI based on selected option and there is no space for empty selection.
p.s. I've already set {clearable:false}. It just does not renders the clear component. But user can still clear it by selecting the same option again!

@alsoscotland
Copy link
Owner

@thumarmahesh
That seems to go against the paradigm of how an html select control works.
Perhaps your use case falls more in line with a control that mimics the behavior of groups of radio buttons

@microtheta
Copy link
Author

microtheta commented Nov 8, 2016

Thanks @alsoscotland for replying.

Actually my case is more aligned with html (<select />) control only. <select> control will not allow you to deselect the option once you've selected it!
You've to add an empty option (may be at the top) and select that to deselect the current option in html <select> control.

So, I think both cases are in line with a select control only :)

Can't we simply stop deselection when {clearable:false} is set?

@alsoscotland
Copy link
Owner

@thumarmahesh
I do not want to overload that property with multiple responsibilities. It is used to control whether or not the clear button shows in the trigger. I am going to investigate adding a property for this purpose.

@microtheta
Copy link
Author

great, thanks @alsoscotland :)

@alsoscotland
Copy link
Owner

@thumarmahesh
https://github.com/alsoscotland/react-super-select/tree/v0.5.7
adds a deselectOnSelectedOptionClick option. set it to false for the behavior you requested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants