From be047574646ff09b78cc0e9c99e0cbea3bd36f2d Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 3 Mar 2023 14:16:15 +0100 Subject: [PATCH] A11y: The keyboard focus should go back to the close button when 'cancel' is selected on the save changes dialog (fix #174293) (#176040) --- src/vs/workbench/browser/parts/editor/editorGroupView.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index 703f1705202..364f0ad171c 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -1544,8 +1544,10 @@ export class EditorGroupView extends Themable implements IEditorGroupView { // No auto-save on focus change or custom confirmation handler: ask user if (!autoSave) { - // Switch to editor that we want to handle for confirmation - await this.doOpenEditor(editor); + // Switch to editor that we want to handle for confirmation unless showing already + if (!this.activeEditor || !this.activeEditor.matches(editor)) { + await this.doOpenEditor(editor); + } // Let editor handle confirmation if implemented if (typeof editor.closeHandler?.confirm === 'function') {