Skip to content

Keep disabled choices out of search selections - #531

Open
HocVoNgThai wants to merge 1 commit into
tmbo:masterfrom
HocVoNgThai:fix/disabled-search-choices
Open

HocVoNgThai wants to merge 1 commit into
tmbo:masterfrom
HocVoNgThai:fix/disabled-search-choices

Conversation

@HocVoNgThai

Copy link
Copy Markdown

What is the problem that this PR addresses?

Filtering can make disabled choices selectable in both select() and checkbox(). For example, searching bet in ['alpha', Choice('beta', disabled=True), 'betty'] and pressing Enter returns the disabled beta rather than betty.

How did you solve it?

Exclude disabled choices from search matches, check navigation against the displayed choices and move the cursor to a selectable item after filtering. The example now returns betty. If no enabled choice matches, preserve the existing full-list fallback while skipping disabled entries. Adds four regression cases covering both prompts and fallback behavior.

Checklist

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

Closes #530

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.

Search filtering allows disabled choices to be selected

1 participant