Ability to swap out single option #176
Labels
discussion
Gathering feedback on open questions
enhancement
New feature or request
UX
User experience
Problem
At the moment it's impossible to swap out a single option in the middle of the options list. This can be troublesome for applications where the order matters.
Example of problem
Take this example:
I have the following options selected:
Now I want to swap out
C
withCoffeeScript
, and keep the sorting. So I want the options list to change to this:In order to do this atm, I would have to delete all options after
C
, andC
itself, then addCoffeeScript
and re-add the other options in the correct order. This is not ideal, but not such a big issue in this case. However, the more options there are after the one we want to change, the more tedious and error-prone this approach gets. Imagine having to delete and re-add 40 options, it would be impossible without saving an image of the previous setups somehow.Solution
To fix this, I suggest that we add input fields to the clicked option on click. So If I click on
C
, it should replace theC
option with an input field. This input field will then be used to search for the replacement forC
. If I click out of the dropdownC
should still be selected, but if I choose another option in the list, thenC
should be replaced by that option.Start state
Clicking on
C
After clicking, the dropdown menu opens up, and
C
is turned into an input field. In the dropdown list,C
is highlighted to clearly show that it was the previously selected option.Clicking on
CoffeeScript
After clicking on
CoffeeScript
, the input field is replaced withCoffeeScript
End state
Code used in this example
```htmlalternative styling
![image](https://user-images.githubusercontent.com/43886029/203946715-750cb6ad-0d3e-4be0-9dae-f5f3e42332c6.png) ![image](https://user-images.githubusercontent.com/43886029/203946719-9faf1e90-d7c1-40da-8152-d7da49931295.png)More Info
Now if we do this, the input field at the end of the multiselect will be obsolete for single-select configurations. Therefore it makes sense to conditionally render it based on this if
This will also fix #174
Acceptance Criteria
For illustrative purposes I'll be using
C
as the previously selected option, andCoffeeScript
as the option we want to replace it with.C
) with an input field which is automatically focused.C
) should be visible at the top of the list, and highlighted.C
) should replace the input again. Returning the multiselect to the same state as before.Erlang
) from the dropdown. Then the input field should be replaced with said option (Erlang
).The text was updated successfully, but these errors were encountered: