From b1bf11ba4e17ecd3bd0e7128b015b6d39c10a856 Mon Sep 17 00:00:00 2001 From: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Date: Fri, 9 May 2025 13:51:30 +0100 Subject: [PATCH] [Console] Fix autoselecting last request (#218001) Fixes https://github.com/elastic/kibana/issues/194257 ## Summary This PR fixes the bug in Console where, if there is a request on the last line of the editor, it gets automatically selected when the editor is open. This is because the cursor is initially placed at the last position of the edition, and if this position turn out to be at the end of the request, the request is selected because the editor is on focus. We fix this by not focusing the editor initially (i.e. there is no blinking cursor when you open the editor) - this ensures that there won't be any initial request highlighting as per the logic on the following line: https://github.com/elastic/kibana/blob/5c78ff18484e77b5ec5a4ba2ab341ed65db4f21c/src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_actions_provider.ts#L73) https://github.com/user-attachments/assets/6f10e59b-92c7-4501-bf01-54987bc2f289 (cherry picked from commit 7be65de507d828f508348f7f7b7ad5e1476833f5) --- .../containers/editor/monaco_editor_actions_provider.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_actions_provider.ts b/src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_actions_provider.ts index 8ab6828b9aaf3..426d7a5bd5945 100644 --- a/src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_actions_provider.ts +++ b/src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_actions_provider.ts @@ -64,7 +64,6 @@ export class MonacoEditorActionsProvider { private setEditorActionsCss: (css: CSSProperties) => void, private isDevMode: boolean ) { - this.editor.focus(); this.parsedRequestsProvider = getParsedRequestsProvider(this.editor.getModel()); this.highlightedLines = this.editor.createDecorationsCollection();