[PR #4866] [CLOSED] Chat History Top/Bottom Scroll With Keybindings #4794

Closed
opened 2026-02-22 18:36:32 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4866
Author: @angelplusultra
Created: 1/15/2026
Status: Closed

Base: masterHead: 4845-keyboard-shortcuts-to-navigate-in-chat


📝 Commits (2)

  • c4e6026 Enhance chat functionality with keyboard shortcuts for scrolling to the top or bottom of chat history.
  • 816b20f lint/format

📊 Changes

2 files changed (+92 additions, -13 deletions)

View changed files

📝 frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx (+68 -12)
📝 frontend/src/components/WorkspaceChat/ChatContainer/index.jsx (+24 -1)

📄 Description

Pull Request Type

  • feat

Relevant Issues

resolves #4845

What is in this change?

Adds keyboard shortcuts to navigate chat history: Ctrl/Cmd + Up Arrow scrolls to the top of the chat history, and Ctrl/Cmd + Down Arrow scrolls to the bottom. These shortcuts work from anywhere in the chat container (not just when focused on the prompt input) and preserve the existing auto-scroll behavior during message streaming.

Key Features:

  • Keyboard shortcuts: Ctrl/Cmd + Up and Ctrl/Cmd + Down for quick navigation
  • Cross-platform support: Automatically detects Mac (Cmd) vs Windows/Linux (Ctrl)
  • Smooth scrolling: Both directions use smooth scroll animations for better UX
  • Auto-scroll preservation: Does not interfere with existing auto-scroll logic that scrolls to bottom when prompts are sent and during response streaming

Technical Implementation:

  • Converted ChatHistory component to use forwardRef to expose scroll methods
  • Added isProgrammaticScroll flag to distinguish keyboard-triggered scrolls from user-initiated scrolls
  • Modified auto-scroll effect to skip during programmatic scrolls to prevent conflicts
  • Updated scroll handler to ignore programmatic scrolls when detecting user scrolling state
  • When scrolling to bottom via keyboard, automatically re-enables auto-scroll for streaming responses

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated (N/A - no user-facing docs needed)
  • I have tested my code functionality
  • Docker build succeeds locally (N/A - frontend-only changes)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/4866 **Author:** [@angelplusultra](https://github.com/angelplusultra) **Created:** 1/15/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `4845-keyboard-shortcuts-to-navigate-in-chat` --- ### 📝 Commits (2) - [`c4e6026`](https://github.com/Mintplex-Labs/anything-llm/commit/c4e602689b1f2119e886f84e805f9c48f2a8c5c8) Enhance chat functionality with keyboard shortcuts for scrolling to the top or bottom of chat history. - [`816b20f`](https://github.com/Mintplex-Labs/anything-llm/commit/816b20f099343535dcdaa40ae620f4c8ec9abb5f) lint/format ### 📊 Changes **2 files changed** (+92 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx` (+68 -12) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/index.jsx` (+24 -1) </details> ### 📄 Description ### Pull Request Type - [x] ✨ feat ### Relevant Issues resolves #4845 ### What is in this change? Adds keyboard shortcuts to navigate chat history: `Ctrl/Cmd + Up Arrow` scrolls to the top of the chat history, and `Ctrl/Cmd + Down Arrow` scrolls to the bottom. These shortcuts work from anywhere in the chat container (not just when focused on the prompt input) and preserve the existing auto-scroll behavior during message streaming. **Key Features:** - **Keyboard shortcuts**: `Ctrl/Cmd + Up` and `Ctrl/Cmd + Down` for quick navigation - **Cross-platform support**: Automatically detects Mac (`Cmd`) vs Windows/Linux (`Ctrl`) - **Smooth scrolling**: Both directions use smooth scroll animations for better UX - **Auto-scroll preservation**: Does not interfere with existing auto-scroll logic that scrolls to bottom when prompts are sent and during response streaming **Technical Implementation:** - Converted `ChatHistory` component to use `forwardRef` to expose scroll methods - Added `isProgrammaticScroll` flag to distinguish keyboard-triggered scrolls from user-initiated scrolls - Modified auto-scroll effect to skip during programmatic scrolls to prevent conflicts - Updated scroll handler to ignore programmatic scrolls when detecting user scrolling state - When scrolling to bottom via keyboard, automatically re-enables auto-scroll for streaming responses ### Developer Validations - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated (N/A - no user-facing docs needed) - [x] I have tested my code functionality - [x] Docker build succeeds locally (N/A - frontend-only changes) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:36:32 -05:00
yindo closed this issue 2026-02-22 18:36:32 -05:00
yindo changed title from [PR #4866] Chat History Top/Bottom Scroll With Keybindings to [PR #4866] [CLOSED] Chat History Top/Bottom Scroll With Keybindings 2026-06-05 15:20:24 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4794