spring-shell
spring-shell copied to clipboard
Enable Esc Key Functionality to Cancel Single Select and Other Components
Presently, the Single Select component does not provide an option to cancel the selection; a choice is mandatory. For enhanced usability, it would be advantageous to incorporate a feature where the selection process can be cancelled by pressing the 'Esc' key.
Currently, my workaround involves adding an extra 'Cancel' item to the selection, which then returns an empty string when chosen. This triggers the cancellation of the command when the returned string is empty. However, this doesn't seem like the most efficient solution. Implementing a keyboard shortcut like the 'Esc' key would make this process more intuitive and user-friendly.
Would it work if we add radio button mode to multi selector?
Looking i.e. github cli, they seem to use dump item as well:
Creating issue in jvalkeal/atest7
? Title asdf
? Body <Received>
? What's next? Add metadata
? What would you like to add? Milestone
? Milestone [Use arrows to move, type to filter]
(none)
1.0.0
> 1.0.1
I just wonder if using esc trick is confusing(thought it could be optional feature).
I apologize for any confusion, but I'm not completely clear on how the radio button proposal would solve the current issue. Could you please elaborate on this?
With regards to the 'Esc' key functionality, I believe it would align more closely with user instincts, at least in my personal experience, to cancel the selection process. My first impulse when I wished to cancel was indeed to press 'Esc'. If the more conventional method in command line interfaces is to employ a dummy entry, then I'm certainly open to that approach. Nonetheless, having the 'Esc' key feature as an optional implementation would be beneficial, in my opinion.
The reason I brought this matter to attention was to explore the possibility of integrating such a cancellation mechanism within the standard components, be it through the 'Esc' key, a dummy item, or perhaps even both. My intention is to enhance usability and make the user/dev experience more intuitive.
If we'd have a radio mode in a multiselect it'd essentially allow to enable one or zero items in it assuming that there would not be default selection enabled.
But having said that I think it's reasonable request to move forward from a single select without selecting an item(which now happens when pressing enter).
Thank you for your explanation. I now understand how the "radio mode" could work in a multi-select component. I'm glad you see the value in a more intuitive cancellation method for the select component.
Looking forward to seeing these improvements.