[PR #23371] [CLOSED] fix: keep viewport stable during fallback copy #66027

Closed
opened 2026-05-06 12:07:42 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23371
Author: @suyua9
Created: 4/3/2026
Status: Closed

Base: devHead: fix/copy-selection-scrolltop-suyua9


📝 Commits (1)

  • b9952ec fix: preserve scroll position during fallback copy

📊 Changes

1 file changed (+18 additions, -2 deletions)

View changed files

📝 src/lib/utils/index.ts (+18 -2)

📄 Description

Pull Request Checklist

  • Target branch: Verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request down below.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: No docs repo change needed for this small bug fix.
  • Dependencies: No new or upgraded dependencies.
  • Testing: I manually tested the fix in a long chat, verified copy actions no longer jump the viewport, and ran git diff --check.
  • Agentic AI Code: I manually reviewed and tested the final patch before opening this PR.
  • Code review: I performed a self-review of the code change.
  • Design & Architecture: The change stays inside the existing shared clipboard fallback path and does not add new settings.
  • Git Hygiene: This PR is a single logical change rebased onto dev.
  • Title Prefix: fix

Changelog Entry

Description

  • Preserve the current viewport when Open WebUI falls back to the textarea-based clipboard copy path.

Added

  • None.

Changed

  • Restore the prior scroll position and focused element after fallback copy completes.

Deprecated

  • None.

Removed

  • None.

Fixed

  • Prevent inline code, code block, and response copy actions from jumping long chats back to the top when navigator.clipboard is unavailable.

Security

  • None.

Breaking Changes

  • BREAKING CHANGE: None.

Additional Information

  • Refs [PR #14024] [MERGED] i18n: update ko-KR (#23363)
  • Manual test steps:
    1. Open a long chat with enough content to scroll well below the top.
    2. Click copy on a response or code block in an environment that uses the fallback clipboard path.
    3. Confirm the chat stays at the same scroll position after the copy succeeds.

Screenshots or Videos

  • Not included for this small utility fix.

Contributor License Agreement


🔄 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/open-webui/open-webui/pull/23371 **Author:** [@suyua9](https://github.com/suyua9) **Created:** 4/3/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/copy-selection-scrolltop-suyua9` --- ### 📝 Commits (1) - [`b9952ec`](https://github.com/open-webui/open-webui/commit/b9952ec2887f8798daf100d970ae42f1c86bbab3) fix: preserve scroll position during fallback copy ### 📊 Changes **1 file changed** (+18 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/utils/index.ts` (+18 -2) </details> ### 📄 Description # Pull Request Checklist - [x] **Target branch:** Verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request down below. - [x] **Changelog:** Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description. - [ ] **Documentation:** No docs repo change needed for this small bug fix. - [x] **Dependencies:** No new or upgraded dependencies. - [x] **Testing:** I manually tested the fix in a long chat, verified copy actions no longer jump the viewport, and ran `git diff --check`. - [x] **Agentic AI Code:** I manually reviewed and tested the final patch before opening this PR. - [x] **Code review:** I performed a self-review of the code change. - [x] **Design & Architecture:** The change stays inside the existing shared clipboard fallback path and does not add new settings. - [x] **Git Hygiene:** This PR is a single logical change rebased onto `dev`. - [x] **Title Prefix:** `fix` # Changelog Entry ### Description - Preserve the current viewport when Open WebUI falls back to the textarea-based clipboard copy path. ### Added - None. ### Changed - Restore the prior scroll position and focused element after fallback copy completes. ### Deprecated - None. ### Removed - None. ### Fixed - Prevent inline code, code block, and response copy actions from jumping long chats back to the top when `navigator.clipboard` is unavailable. ### Security - None. ### Breaking Changes - **BREAKING CHANGE**: None. --- ### Additional Information - Refs #23363 - Manual test steps: 1. Open a long chat with enough content to scroll well below the top. 2. Click copy on a response or code block in an environment that uses the fallback clipboard path. 3. Confirm the chat stays at the same scroll position after the copy succeeds. ### Screenshots or Videos - Not included for this small utility fix. ### Contributor License Agreement - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 12:07:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#66027