Skip to content

Respect disabled menu items on keyboard activation - #2141

Open
FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-disabled-menu-activation-20261016
Open

FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-disabled-menu-activation-20261016

Conversation

@FanWu-ai

Copy link
Copy Markdown

The menu's Enter handler invokes actions even when their MenuItem has disabled=True. Opening a submenu selects its first child, so Down followed by Enter can run a disabled action; the existing submenu mouse handler already rejects it.

Check the current disabled flag before invoking the handler or changing focus. Menu navigation remains unchanged. Seven new cases cover enabled/disabled actions at three depths and disabling/re-enabling an already selected item.

Validation on Linux / CPython 3.12.14:

  • Pristine complete suite: 156 passed; final complete suite: 163 passed.
  • Four added cases fail against the original implementation.
  • Ruff lint/format, typos, strict mypy for win32/linux/darwin, all 12 pinned hooks, wheel/sdist builds, and git diff --check pass.
  • Independent automated review reran the full suite and gates. Packaged implementation bytes match the tested source.

The mypy platform targets are static checks; other interpreter/native OS matrix combinations were not run locally.

Prepared and tested with OpenAI Codex assistance. No human review is claimed.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 15, 2026 21:32
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.

1 participant