Skip to content

feat: scroll the message list with PageUp/PageDown#3738

Open
LawrenceGK wants to merge 1 commit into
chatboxai:mainfrom
LawrenceGK:scroll-shortcut
Open

feat: scroll the message list with PageUp/PageDown#3738
LawrenceGK wants to merge 1 commit into
chatboxai:mainfrom
LawrenceGK:scroll-shortcut

Conversation

@LawrenceGK

Copy link
Copy Markdown

Description

Adds keyboard paging over the conversation view via PageUp / PageDown.

On desktop the input box is usually focused, so the browser never scrolls the (react-virtuoso) message container on its own when these keys are pressed. This wires them up to scroll the conversation explicitly, driving the VirtuosoHandle already exposed on uiStore (messageScrolling). Each press scrolls by ~90% of the viewport height as an instant jump, matching native PageUp/PageDown. The keys don't conflict with text input, so they work regardless of focus.

The shortcut is also surfaced in Settings → Hotkeys as two read-only rows ("Scroll Up / Down the Message List"), kept hardcoded like the other non-configurable shortcuts (e.g. mod+1-9). Added Page Up / Page Down key labels to formatKey, plus en / zh-Hans / zh-Hant translations.

Files changed:

  • src/renderer/hooks/useShortcut.tsx — PageUp/PageDown handler driving the VirtuosoHandle
  • src/renderer/components/Shortcut.tsx — two read-only Hotkeys rows + Page Up / Page Down labels
  • src/renderer/i18n/locales/{en,zh-Hans,zh-Hant}/translation.json — new strings

Additional Notes

  • No new settings field — the shortcut is hardcoded like the existing ones handled in useShortcut, so it isn't user-rebindable.
  • Self-contained: touches only the renderer shortcut handler, the Hotkeys settings list, and translations.
  • Other locales fall back to English (fallbackLng: 'en') and can be filled in later by the existing translation pipeline.

Screenshots

N/A — keyboard-only interaction. The only visual change is two read-only rows added to Settings → Hotkeys.

Contributor Agreement

By submitting this Pull Request, I confirm that I have read and agree to the following terms:

  • I agree to contribute all code submitted in this PR to the open-source community edition licensed under GPLv3 and the proprietary official edition without compensation.
  • I grant the official edition development team the rights to freely use, modify, and distribute this code, including for commercial purposes.
  • I confirm that this code is my original work, or I have obtained the appropriate authorization from the copyright holder to submit this code under these terms.
  • I understand that the submitted code will be publicly released under the GPLv3 license, and may also be used in the proprietary official edition.

Please check the box below to confirm:

[x] I have read and agree with the above statement.

Add keyboard paging over the conversation view. The input box is usually
focused, so the browser won't scroll the Virtuoso message container on its
own; drive it explicitly via the VirtuosoHandle already exposed on uiStore
(messageScrolling), scrolling by ~90% of the viewport height with an instant
jump (matches native PageUp/PageDown).

Also surface the shortcut in Settings > Hotkeys as two read-only rows (kept
hardcoded like the other non-configurable shortcuts, e.g. mod+1-9) and add the
'Page Up'/'Page Down' key labels plus en/zh-Hans/zh-Hant translations.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c8b346d8-26b1-4a22-9288-f4542f7615c1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@themez themez requested a review from ryanwangtian June 2, 2026 08:15
@themez

themez commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR. I checked the diff and tried applying it locally. The patch is mergeable and VirtuosoHandle.scrollBy() is available in the current react-virtuoso, but I do not think this should be merged as-is.

Main blocker: the new PageUp/PageDown handler is registered on global window.keydown. As long as messageScrolling exists, it calls preventDefault() and scrolls the message list regardless of where focus currently is. That means PageUp/PageDown inside Settings, Search, other dialogs, inputs/textareas, or contenteditable areas can be intercepted and scroll the chat behind the active UI. The PR description says these keys do not conflict with text input, but in practice they are native paging/navigation keys in many focused controls and modal surfaces.

Suggested fix: only handle PageUp/PageDown when the active context is the chat page/message input/body, and explicitly skip dialogs/modals plus input, textarea, select, and [contenteditable] targets.

One more project-specific issue: this PR hand-edits src/renderer/i18n/locales/*/translation.json. These locale files are generated in this repo, so new i18n keys should be added from source and translations should go through the existing translation generation flow rather than editing generated locale JSON directly.

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