Skip to content

Multiselection hints are too obscure #436

@InAnYan

Description

@InAnYan

Describe the problem

Originally, I raised this issue in copier repo. Pasting it here, as copier relies on this library.

Image

Code:

import questionary

questionary.checkbox(
   'tags',
   choices=[
       "A",
       "B",
       "C",
   ]).ask()
  • <space> to select - select what?
  • <a> to toggle - toggle what?
  • <i> to invert - invert what?

Initially, I thought that all these actions refer to a (one) selection. But in this case, all these actions would do the same thing.

Only after playing around with all keys, I understood everything

Describe the solution

Let's address this bit by bit.

What actions do:

  • <space> to select - toggles a single option under the arrow.
  • <a> to toggle - either:
    • Selects every option.
    • Deselects every option.
  • <i> to invert - inverts current assignments. What was selected become deselected, what was deselected became selected.

Scopes:

  • <space> to select - single choice.
  • <a> to toggle - all choices.
  • <i> to invert - all choices.

Maybe rewrite it like this:

  • <space> to select - <space> toggle
  • <a> to toggle - <a> select all
  • <i> to invert - <i> invert selection

If we came to consensus, I can make a PR.

@pawamoy also suggested this:

  • <space> (un)select
  • <a> (un)select all
  • <i> invert selection

And also we had an idea for new option:

  • <enter> confirm

Alternatives considered

questionary.checkbox has option instruction with which we can configure what hinting text is displayed.

Which is awesome!

But still IMHO default hints can be improved a bit. Free to discuss 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions