From 4ad528206382201a80f951cc87e12f8ce906c777 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Fri, 23 Jan 2026 10:58:54 +0100 Subject: [PATCH] :bug: Fix blur events for text editor v2 in firefox --- .../src/app/main/ui/workspace/shapes/text/v2_editor.cljs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs index 410498e13f..0d6fdd3700 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs @@ -138,7 +138,6 @@ (st/emit! (dw/set-clipboard-style style))))] (.addEventListener ^js global/document "keyup" on-key-up) - (.addEventListener ^js instance "blur" on-blur) (.addEventListener ^js instance "focus" on-focus) (.addEventListener ^js instance "needslayout" on-needs-layout) (.addEventListener ^js instance "stylechange" on-style-change) @@ -153,8 +152,12 @@ ;; This function is called when the component is unmounted (fn [] + ;; Explicitly call on-blur here instead of relying on browser blur events, + ;; because in Firefox blur is not reliably fired when leaving the text editor + ;; by clicking elsewhere. The component does unmount when the shape is + ;; deselected, so we can safely call the blur handler here to finalize the editor. + (on-blur) (.removeEventListener ^js global/document "keyup" on-key-up) - (.removeEventListener ^js instance "blur" on-blur) (.removeEventListener ^js instance "focus" on-focus) (.removeEventListener ^js instance "needslayout" on-needs-layout) (.removeEventListener ^js instance "stylechange" on-style-change)