From dd32a91d8a000eb512c67d6a03b5950e4dba9e85 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Tue, 21 Jul 2026 02:12:49 +0200 Subject: [PATCH] Fix vscode focus --- src/renderview.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/renderview.js b/src/renderview.js index f8e27b1..b0e60d9 100644 --- a/src/renderview.js +++ b/src/renderview.js @@ -595,8 +595,10 @@ class BaseRenderView { viewElement.addEventListener('pointerdown', (ev) => { // When pointer is down, set focus to the focus-element. + // Focus after a short delay, otherwise VSCode takes focus away immediately. if (!LOOKS_LIKE_MOBILE) { - this._focusElement.focus({ preventScroll: true, focusVisible: false }) + const fe = this._focusElement + window.setTimeout(function () { fe.focus({ preventScroll: true, focusVisible: false }) }, 50) } // capture the pointing device. // Because we capture the event, there will be no other events when buttons are pressed down,