Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disabled Choice binding shortcut_key #334

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Conversation

weiduhuo
Copy link
Contributor

@weiduhuo weiduhuo commented Nov 12, 2023

What is the problem that this PR addresses?

When defining a Choice type option with simultaneously setting the shortcut_key attribute to str type and setting the
disabled attribute to be not None, there is an unexpected ability that we can interact with this option using keyboard shortcuts.

example:

import questionary
from questionary import Choice

options = [
    Choice("One", disabled=True),
    Choice("Three", shortcut_key="3", disabled=True),
    Choice("Two"),
    Choice("Four"),
]
questionary.select("Title: ", options, use_shortcuts=True).ask()

2023-11-12-3367

How did you solve it?

I cancel the disabled choice binding the key.

Checklist

  • I have read the Contributor's Guide.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Copy link
Collaborator

@kiancross kiancross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me. Can you force-push the commit to re-trigger the CI?

@weiduhuo weiduhuo requested a review from kiancross January 9, 2024 06:05
@kiancross kiancross merged commit d21ba3e into tmbo:master Jan 11, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants