From 6b9fbf8ce5463b78c8289f2694a0ac7c2d8f238f Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:05:44 +1000 Subject: [PATCH] [8.x] Auto-focus ES|QL editor on mount (#193800) (#193818) # Backport This will backport the following commits from `main` to `8.x`: - [Auto-focus ES|QL editor on mount (#193800)](https://github.com/elastic/kibana/pull/193800) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Nathan L Smith --- packages/kbn-esql-editor/src/esql_editor.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/kbn-esql-editor/src/esql_editor.tsx b/packages/kbn-esql-editor/src/esql_editor.tsx index b4d169f278a0e..244abba93a5f9 100644 --- a/packages/kbn-esql-editor/src/esql_editor.tsx +++ b/packages/kbn-esql-editor/src/esql_editor.tsx @@ -719,6 +719,10 @@ export const ESQLEditor = memo(function ESQLEditor({ }); editor.onDidChangeModelContent(showSuggestionsIfEmptyQuery); + + // Auto-focus the editor and move the cursor to the end. + editor.focus(); + editor.setPosition({ column: Infinity, lineNumber: Infinity }); }} />