Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

When a list item is taller than the viewport (e.g., long chat responses), list.focusPageUp/Down now scrolls within that item instead of immediately jumping to the next/previous item.

Changes

Modified focusNextPage and focusPreviousPage in listWidget.ts:

  • Detect when focused element extends beyond viewport bounds
  • Scroll by viewport height while maintaining focus on the same item
  • Move to next/previous item only after reaching element boundaries
  • Preserve existing behavior for normal-sized items

Example scenario:

Item height: 500px, Viewport: 200px
User on Item 0, scrollTop: 0

PageDown #1: scrollTop → 200px (still Item 0)
PageDown #2: scrollTop → 400px (still Item 0)
PageDown #3: Focus moves to Item 1

Added test coverage:

  • Tall items spanning 2.5 pages
  • Multiple page-down operations within single item
  • Page-up scrolling back through tall item
Original prompt

This section details on the original issue you should resolve

<issue_title>Scroll lists by page</issue_title>
<issue_description>We have the commands list.focusPageUp/Down for paging in lists, but this only works by moving focus to the index that is up/down a page, and doesn't work right for long list items. We also have list.scrollUp/Down to just scroll the list, but it's slow. I think it would be helpful, especially for chat where list items are really long, to have a paging command that can just scroll. microsoft/vscode-copilot-release#1482 (comment)

I think it would make sense for list.focusPageUp/Down to also just scroll, when the same row takes up multiple pages. Could also add a new scroll command for this though. cc @joaomoreno </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 17, 2025 03:44
- Modified focusNextPage to scroll by page height when focused element extends beyond viewport
- Modified focusPreviousPage to scroll by page height when focused element extends above viewport
- Added test case for scrolling within tall items that span multiple pages
- Existing tests still pass for items equal to viewport height

Co-authored-by: roblourens <323878+roblourens@users.noreply.github.com>
- Fixed paddingTop calculation in focusPreviousPage to use getScrollTop() directly
- Added constants in test to clarify viewport and item height relationship
- Improved code maintainability and readability

Co-authored-by: roblourens <323878+roblourens@users.noreply.github.com>
- Simplified code by using scrollTop directly instead of aliasing to viewportTop
- Improved code readability

Co-authored-by: roblourens <323878+roblourens@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance scrolling behavior in list commands Scroll by page height when list items span multiple pages Dec 17, 2025
Copilot AI requested a review from roblourens December 17, 2025 03:56
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.

Scroll lists by page

2 participants