Skip to content

Commit 5ff89fb

Browse files
authored
Merge pull request microsoft#188987 from microsoft/merogge/editor-hover
focus the editor hover on escape of accessible view so focus is not lost
2 parents d72df86 + 76fc106 commit 5ff89fb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/vs/workbench/contrib/accessibility/browser/accessibility.contribution.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,16 @@ class HoverAccessibleViewContribution extends Disposable {
114114
const codeEditorService = accessor.get(ICodeEditorService);
115115
const editor = codeEditorService.getActiveCodeEditor() || codeEditorService.getFocusedCodeEditor();
116116
const editorHoverContent = editor ? ModesHoverController.get(editor)?.getWidgetContent() ?? undefined : undefined;
117-
if (!editorHoverContent) {
117+
if (!editor || !editorHoverContent) {
118118
return false;
119119
}
120120
this._options.language = editor?.getModel()?.getLanguageId() ?? undefined;
121121
accessibleViewService.show({
122122
verbositySettingKey: AccessibilityVerbositySettingId.Hover,
123123
provideContent() { return editorHoverContent; },
124-
onClose() { },
124+
onClose() {
125+
ModesHoverController.get(editor)?.focus();
126+
},
125127
options: this._options
126128
});
127129
return true;

src/vs/workbench/contrib/accessibility/browser/accessibleView.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ class AccessibleView extends Disposable {
211211
this._configurationService.updateValue(settingKey, false);
212212
}
213213
provider.onKeyDown?.(e);
214-
// e.stopPropagation();
215214
}));
216215
disposableStore.add(this._editorWidget.onKeyDown((e) => {
217216
if (e.keyCode === KeyCode.Escape) {

0 commit comments

Comments
 (0)