From 08c3fbfb0a4fb75de7f285ff3df286390d2db100 Mon Sep 17 00:00:00 2001
From: Ariya Hidayat <ariya@metabase.com>
Date: Thu, 13 Jan 2022 13:32:47 -0800
Subject: [PATCH] Custom expression editor: workaround focus issue on Firefox
 (#19670)

---
 .../components/expressions/ExpressionEditorTextfield.jsx    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/frontend/src/metabase/query_builder/components/expressions/ExpressionEditorTextfield.jsx b/frontend/src/metabase/query_builder/components/expressions/ExpressionEditorTextfield.jsx
index 71d5b34a717..b1beb911400 100644
--- a/frontend/src/metabase/query_builder/components/expressions/ExpressionEditorTextfield.jsx
+++ b/frontend/src/metabase/query_builder/components/expressions/ExpressionEditorTextfield.jsx
@@ -248,6 +248,12 @@ export default class ExpressionEditorTextfield extends React.Component {
     if (this.input.current) {
       const { editor } = this.input.current;
       this.handleCursorChange(editor.selection);
+
+      // workaround some unknown issue on Firefox
+      // without explicit focus, the editor is vertically shifted
+      setTimeout(() => {
+        editor.focus();
+      }, 0);
     }
   };
 
-- 
GitLab