[PR #211] [MERGED] fix(chat): keep branch selector open while scrolling its list #4506

Closed
opened 2026-10-22 04:08:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/211
Author: @LukaTheHero
Created: 4/24/2026
Status: ✅ Merged
Merged: 4/24/2026
Merged by: @LukaTheHero

Base: main ← Head: fix/chat-branch-selector-scroll-close


📝 Commits (1)

  • de44b18 fix(chat): keep branch selector open while scrolling its list

📊 Changes

1 file changed (+10 additions, -5 deletions)

View changed files

📝 packages/client/src/components/chat/ChatBranchSelector.tsx (+10 -5)

📄 Description

Summary

  • Fixes a bug reported by @DarkPulse #208 where the chat branch selector closes the moment you try to mousewheel or drag its scrollbar when there are enough branches (~7+) to overflow the list.
  • Root cause: the open-popover effect installed a capture-phase scroll listener on window that called setOpen(false) on any scroll event — including scrolls inside the popover's own overflow-y-auto list. The "popover shifts for a frame then closes" symptom the reporter saw was the list scrolling before the close fired.
  • Fix: split the single handler into handleResize (unchanged behavior) and handleScroll, which ignores scroll events whose target is inside popoverRef. Outside scrolls (page, sidebar, etc.) still close the popover as intended.

Test plan

  • Open an RP with 10+ branches and drop down the chat branch selector.
  • Mousewheel down inside the list — popover stays open and list scrolls.
  • Drag the popover scrollbar — popover stays open during the drag.
  • Click a branch — popover closes and switches branch as before.
  • Scroll the page/sidebar outside the popover — popover still closes (existing behavior preserved).
  • Resize the window — popover still closes (existing behavior preserved).
  • Press Escape / click outside — popover still closes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved chat branch selector popover behavior: the popover now correctly remains open when scrolling within its boundaries, while properly responding to resize events and external scroll actions.

🔄 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/Pasta-Devs/Marinara-Engine/pull/211 **Author:** [@LukaTheHero](https://github.com/LukaTheHero) **Created:** 4/24/2026 **Status:** ✅ Merged **Merged:** 4/24/2026 **Merged by:** [@LukaTheHero](https://github.com/LukaTheHero) **Base:** `main` ← **Head:** `fix/chat-branch-selector-scroll-close` --- ### 📝 Commits (1) - [`de44b18`](https://github.com/Pasta-Devs/Marinara-Engine/commit/de44b181bb30a7a4bb1293f0fdf83f359c42f275) fix(chat): keep branch selector open while scrolling its list ### 📊 Changes **1 file changed** (+10 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatBranchSelector.tsx` (+10 -5) </details> ### 📄 Description ## Summary - Fixes a bug reported by @DarkPulse #208 where the chat branch selector closes the moment you try to mousewheel or drag its scrollbar when there are enough branches (~7+) to overflow the list. - Root cause: the open-popover effect installed a capture-phase `scroll` listener on `window` that called `setOpen(false)` on any scroll event — including scrolls inside the popover's own `overflow-y-auto` list. The "popover shifts for a frame then closes" symptom the reporter saw was the list scrolling before the close fired. - Fix: split the single handler into `handleResize` (unchanged behavior) and `handleScroll`, which ignores scroll events whose `target` is inside `popoverRef`. Outside scrolls (page, sidebar, etc.) still close the popover as intended. ## Test plan - [x] Open an RP with 10+ branches and drop down the chat branch selector. - [x] Mousewheel down inside the list — popover stays open and list scrolls. - [x] Drag the popover scrollbar — popover stays open during the drag. - [x] Click a branch — popover closes and switches branch as before. - [x] Scroll the page/sidebar outside the popover — popover still closes (existing behavior preserved). - [x] Resize the window — popover still closes (existing behavior preserved). - [x] Press Escape / click outside — popover still closes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved chat branch selector popover behavior: the popover now correctly remains open when scrolling within its boundaries, while properly responding to resize events and external scroll actions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:15 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4506
No description provided.