From 910403c463b385ce800a07f1de229472532e2247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Fri, 21 Nov 2025 15:10:22 +0100 Subject: [PATCH] fix(text-editor): prevent parent container from intercepting editor events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The canvas container's pointer handler was capturing ALL events when the text tool was active, including clicks on the text editor UI (overlay, textarea, handles). This prevented text selection, click-outside commit, and text dragging from working. Now the handler checks if the on-canvas editor is already active and returns early, allowing the OnCanvasTextEditor to handle its own events properly. Fixes: - Text selection now works in textarea - Clicking outside editor commits text - Dragging transform handles moves text 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- components/canvas/canvas-with-tools.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/canvas/canvas-with-tools.tsx b/components/canvas/canvas-with-tools.tsx index 6562e6c..74f3b96 100644 --- a/components/canvas/canvas-with-tools.tsx +++ b/components/canvas/canvas-with-tools.tsx @@ -69,7 +69,7 @@ export function CanvasWithTools() { const { activeTool, settings } = useToolStore(); const { executeCommand } = useHistoryStore(); const { activeSelection, selectionType, isMarching } = useSelectionStore(); - const { textObjects, editingTextId } = useTextStore(); + const { textObjects, editingTextId, isOnCanvasEditorActive } = useTextStore(); const [marchingOffset, setMarchingOffset] = useState(0); const [isPanning, setIsPanning] = useState(false); @@ -227,8 +227,11 @@ export function CanvasWithTools() { return; } - // Text tool + // Text tool - only handle if editor is not already active if (activeTool === 'text') { + // If editor is active, let it handle its own events (selection, dragging, click-outside) + if (isOnCanvasEditorActive) return; + const activeLayer = getActiveLayer(); if (!activeLayer || !activeLayer.canvas || activeLayer.locked) return;