survey
survey copied to clipboard
Skip a select question
When I am using a question with select options, is there a way to skip the question by not selecting any options? We can do this in case of multi-select since we use spacebar to select the options and return key to skip but I couldn't find a way to skip the question in case of select.
Is there a way or workaround for this? cc @AlecAivazis
Hi @AlecAivazis I know you must be busy but I have an urgent PR that is stuck because of this. It would be a great help if you could answer this.
Hey @palash25 - sorry for lagging on responding.
I think for the moment I would recommend 1 of 2 things: Either ask the user with a confirm if they want to choose one of whatever your prompt is selecting, or add an option in the select which you can interpret as no response.
It might make sense to add an Optional
field to each Question
which allows for esc
to cancel them. If you wanted to open a PR I'd love to review it. It'd give me a good starting point to think through the overall user experience. However, since you are currently blocked by this you might want to consider these 2 less than ideal shortcuts.
Question which allows for esc to cancel them. If you wanted to open a PR I'd love to review it.
swamped with work right now but that is a good idea, if I get some time in the coming days I will take a crack at this.
The ESC key is currently already used to exit the vim-mode. So if we add this feature, we need to use another key. If we could decide for another key, I would also offer to see whether I can create a PR.
The more I think about this issue, the more I'm on the side of removing the vim-like interaction so that we can have escape skip optional questions. That seems like a very intuitive interaction. Maybe we have to move the toggle to another key? I'm not sure anything else makes sense for vim...
I also wonder if this would mean we could remove survey.Required
from the list of provided Validator
s in favor of a new Required
field. I'm pretty sure that's required anyway so that we can interpret esc
as skip when the question is optional.
My current feeling is that it does not make sense to have a "skippable" select prompt as described. I would rather see an explicit "no answer" option in the prompt. So instead of something like this:
? Choose a color: [Use arrows to move, space to select, type to filter, ESC to skip]
> red
blue
green
I would recommend a no-op answer, like "none":
? Choose a color: [Use arrows to move, space to select, type to filter]
> none
red
blue
green
If you want to make it easy on the user to "skip" the prompt, you can set Default
to none
and then the user just has to hit enter to bypass the prompt.
Alright then let's leave this out of v2
for now and we can wait for someone else to ask for it before we go too far exploring options and compromises
I'm looking for this very feature, are there any plans for implementing it in the near future?
Why not add option none
(if skip is specified) and color the option (with red or yellow)?
I think having a "none" option is an easy workaround that doesn't require extra support from the library. The right move is to have escape skip the option but we dont have a good opportunity to add it yet
Hello guys, great work. Any update on "Esc" to skip a question?