From ed94df6d8572fbd922b7385fbd27b701a3a3825f Mon Sep 17 00:00:00 2001 From: memeflyfly <55984574+1624318455@users.noreply.github.com> Date: Wed, 6 May 2026 16:20:15 +0800 Subject: [PATCH] fix(group-chat): replace NDropdown with custom dropdown to fix @mention keyboard selection (#479) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: In group chat input, using keyboard (ArrowDown/ArrowUp + Enter) to select an agent from the @mention dropdown always inserts the wrong agent name (the first one), regardless of which item is visually highlighted. Mouse click works correctly. Root cause: naive-ui's NDropdown has its own internal keyboard state machine that is independent from the component's activeIndex ref. When Enter is pressed, NDropdown fires @select using its own stale index before handleKeydown runs, always selecting the wrong agent. NDropdown exposes no public API to synchronize its internal state, making this unfixable in place. Fix: Replace NDropdown with a custom
rendered via v-for, with fully manual keyboard/click/hover control. This eliminates the dual-state conflict entirely — there's a single activeIndex for all interactions. Additional improvements over the previous NDropdown-based implementation: - Scroll follows the active item automatically (scrollToActive) - Dropdown flips upward when insufficient space below (smart placement) - Click-outside-to-close via document-level listener - Transition animation matching NDropdown's fade-in-scale-up exactly (0.2s cubic-bezier, scale 0.9->1 with opacity fade) Co-authored-by: Fix Contributor --- .../hermes/group-chat/GroupChatInput.vue | 168 +++++++++++++++--- 1 file changed, 140 insertions(+), 28 deletions(-) diff --git a/packages/client/src/components/hermes/group-chat/GroupChatInput.vue b/packages/client/src/components/hermes/group-chat/GroupChatInput.vue index 8f6b507..f9165e6 100644 --- a/packages/client/src/components/hermes/group-chat/GroupChatInput.vue +++ b/packages/client/src/components/hermes/group-chat/GroupChatInput.vue @@ -1,9 +1,8 @@