Closed microtheta closed 7 years ago
@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
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?
@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.
great, thanks @alsoscotland :)
@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
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!