Skip to content

Commit 57bf9f5

Browse files
Hongzhi Wenclaude
andcommitted
fix(compact): 历史气泡划词复制时不再误触发导出勾选(Codex P2)
气泡是 user-select:text(故意覆盖 role=button 的 none,支持划词复制),但 export 模式下 onClick 又 toggle 勾选。拖选文字 mouseup 会再冒出一次 click,导致划词复制被误判为勾选。handleClick 在 toggle 前加折叠选区 guard:存在非空非折叠选区时跳过,单击(选区折叠)照常勾选;键盘 Enter/Space 路径不受影响。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent da9f101 commit 57bf9f5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

frontend/react-neko-chat/src/CompactExportHistoryPanel.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,10 @@ export default function CompactExportHistoryPanel({
551551
if (!selectable) return;
552552
if (isSelectionIgnoredTarget(event.target, event.currentTarget)) return;
553553
if (!selectionControlsInteractive) return;
554+
// 气泡是 user-select:text,可划词复制;拖选文字后 mouseup 也会再冒出一次 click。
555+
// 此刻若存在非折叠的非空选区,说明用户在复制文本而非勾选,跳过 toggle 避免误选。
556+
const selection = typeof window !== 'undefined' ? window.getSelection() : null;
557+
if (selection && !selection.isCollapsed && selection.toString().trim().length > 0) return;
554558
onToggleMessage(message.id);
555559
}
556560

0 commit comments

Comments
 (0)