From 1b26b69b25dfdf6f4d4c054cf75aaa359fa63530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Wed, 5 Aug 2026 12:53:20 +0200 Subject: [PATCH] :bug: Fix Firefox not inserting emoji from MacOS Character Viewer (#11072) --- .../app/main/ui/workspace/shapes/text/v3_editor.cljs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/v3_editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/v3_editor.cljs index e626fa2b74..df86b7bb2d 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/v3_editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/v3_editor.cljs @@ -421,9 +421,15 @@ on-blur (mf/use-fn - (fn [^js _event] - (sync-wasm-text-editor-content! {:finalize? true}) - (wasm.api/text-editor-blur))) + (fn [^js event] + ;; MacOS Character Viewer on Firefox fires a `blur` when it opens. + ;; To avoid losing the selected character, we need guard against + ;; `activeElement` being the surface itself. + (when-not (and (some? event) + (= (.-activeElement js/document) + (mf/ref-val contenteditable-ref))) + (sync-wasm-text-editor-content! {:finalize? true}) + (wasm.api/text-editor-blur)))) style #js {:pointerEvents "all" "--editor-container-width" (dm/str width "px")