[PR #8708] [MERGED] fix(client): re-clicking a menu's trigger button closes the menu #8759

Closed
opened 2026-11-07 17:39:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8708
Author: @Gunterlie
Created: 11/3/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/context-menu-reclick-closes


📝 Commits (3)

  • faeb1b2 fix(client): re-clicking a menu's trigger button closes the menu
  • 1287fa6 fix(client): keyboard opens and non-primary presses no longer affect the click swallow
  • 37b9400 Merge branch 'staging' into fix/context-menu-reclick-closes

📊 Changes

1 file changed (+36 additions, -1 deletions)

View changed files

📝 packages/client/src/components/ui/ContextMenu.tsx (+36 -1)

📄 Description

Why

In the Connections sidebar and nearby, clicking the "⋯" button that opened a menu did not close it. ContextMenu closes on an outside mousedown. The trigger button is outside the menu, so the press closed it, and the button's following click reopened it at once.

No linked issue: small bugfix reported directly by the maintainer.

What changed

packages/client/src/components/ui/ContextMenu.tsx only.

  • A module-level capture pointerdown listener records the button under the last left press.
  • Each menu remembers that button as its opener on mount.
  • An outside press on the opener still closes the menu but swallows the following click (one-shot capture listener, removed on the next pointerdown if no click arrives).
  • Presses elsewhere behave as before.

Menus covered

Every ContextMenu user: connection rows, group/folder menus, picture menu, built-in model card, and other app menus. Not affected (they already exclude their own button): ModelPicker, QuickConnectionSwitcher, QuickPersonaSwitcher, HelpTooltip, ChatSidebar status menu.

Validation

  • pnpm check passed locally.
  • Local CodeRabbit: 1 minor finding (use the keyboard opener when autoFocus). Dismissed: autoFocus is not a keyboard signal; its only caller (AgentCatalogView) passes it always, so the change would disable the fix for pointer opens there.
  • Not tested in a browser.

Manual verification (unchecked)

  • Manually verify: click a Connections row ⋯ button twice. The menu opens, then closes.
  • Manually verify: same for a group/folder menu.
  • Manually verify: same for the picture menu.
  • Manually verify: clicking a different button while a menu is open closes the menu and runs that button.

🔄 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/8708 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 11/3/2026 **Status:** ✅ Merged **Merged:** 11/3/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/context-menu-reclick-closes` --- ### 📝 Commits (3) - [`faeb1b2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/faeb1b2e1cc8ea1aabecd82dbd937b3427f85931) fix(client): re-clicking a menu's trigger button closes the menu - [`1287fa6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1287fa6759994c44e7a579a70498c471d9cc078d) fix(client): keyboard opens and non-primary presses no longer affect the click swallow - [`37b9400`](https://github.com/Pasta-Devs/Marinara-Engine/commit/37b940035b8e75cd2ec4427b5dff0eb5634a1d7b) Merge branch 'staging' into fix/context-menu-reclick-closes ### 📊 Changes **1 file changed** (+36 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/ui/ContextMenu.tsx` (+36 -1) </details> ### 📄 Description ## Why In the Connections sidebar and nearby, clicking the "⋯" button that opened a menu did not close it. `ContextMenu` closes on an outside `mousedown`. The trigger button is outside the menu, so the press closed it, and the button's following `click` reopened it at once. No linked issue: small bugfix reported directly by the maintainer. ## What changed `packages/client/src/components/ui/ContextMenu.tsx` only. - A module-level capture `pointerdown` listener records the button under the last left press. - Each menu remembers that button as its opener on mount. - An outside press on the opener still closes the menu but swallows the following `click` (one-shot capture listener, removed on the next `pointerdown` if no click arrives). - Presses elsewhere behave as before. ## Menus covered Every `ContextMenu` user: connection rows, group/folder menus, picture menu, built-in model card, and other app menus. Not affected (they already exclude their own button): ModelPicker, QuickConnectionSwitcher, QuickPersonaSwitcher, HelpTooltip, ChatSidebar status menu. ## Validation - `pnpm check` passed locally. - Local CodeRabbit: 1 minor finding (use the keyboard opener when `autoFocus`). Dismissed: `autoFocus` is not a keyboard signal; its only caller (`AgentCatalogView`) passes it always, so the change would disable the fix for pointer opens there. - Not tested in a browser. ## Manual verification (unchecked) - [ ] Manually verify: click a Connections row ⋯ button twice. The menu opens, then closes. - [ ] Manually verify: same for a group/folder menu. - [ ] Manually verify: same for the picture menu. - [ ] Manually verify: clicking a different button while a menu is open closes the menu and runs that button. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:29 +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#8759
No description provided.