Skip to content

Fix mouse-wheel scrolling in radio and checkbox lists - #2163

Open
leeshengis wants to merge 1 commit into
prompt-toolkit:mainfrom
leeshengis:fix/dialog-list-mouse-wheel
Open

leeshengis wants to merge 1 commit into
prompt-toolkit:mainfrom
leeshengis:fix/dialog-list-mouse-wheel

Conversation

@leeshengis

Copy link
Copy Markdown

Partially addresses #1973: this change fixes mouse-wheel scrolling in long radio and checkbox lists. Clicking the scrollbar is not included.

The list's fragment handler consumes wheel events without handling them. Returning NotImplemented lets the containing Window scroll, but its cursor-preserving scroll logic also needs move_cursor_up and move_cursor_down. The list control now provides those methods, sharing the existing keyboard movement logic and preserving select_on_focus behavior.

Regression tests dispatch mouse events through rendered handlers and cover both list types, focused and unfocused lists, scroll boundaries, checked-value preservation, click selection after scrolling, and select_on_focus.

Validation on Linux / Python 3.12.14:

  • All five new regression cases fail against the unchanged base.
  • Full test suite under coverage: 161 passed.
  • Ruff lint and formatting, typos, and git diff --check passed.
  • Strict mypy passed for Linux, Windows, and macOS targets. Native Windows/macOS runtime tests were not run.

AI assistance was used to investigate the issue, implement the change, and write tests. The diff and test results were also independently reviewed with AI assistance.

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