set tab focus when editable widget focused

This commit is contained in:
meganrogge 2024-03-26 12:46:32 -07:00
parent 95b449d11a
commit 6b8d169dc1
No known key found for this signature in database
GPG key ID: AA74638D4878183D

View file

@ -44,6 +44,7 @@ import { MenuPreventer } from 'vs/workbench/contrib/codeEditor/browser/menuPreve
import { SelectionClipboardContributionID } from 'vs/workbench/contrib/codeEditor/browser/selectionClipboard';
import { getSimpleEditorOptions } from 'vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
import { IMarkdownVulnerability } from '../common/annotations';
import { TabFocus } from 'vs/editor/browser/config/tabFocus';
const $ = dom.$;
@ -334,6 +335,10 @@ export class CodeBlockPart extends Disposable {
await this.updateEditor(data);
this.layout(width);
if (editable) {
this._register(this.editor.onDidFocusEditorWidget(() => TabFocus.setTabFocusMode(true)));
this._register(this.editor.onDidBlurEditorWidget(() => TabFocus.setTabFocusMode(false)));
}
this.editor.updateOptions({ ariaLabel: localize('chat.codeBlockLabel', "Code block {0}", data.codeBlockIndex + 1), readOnly: !editable });
if (data.hideToolbar) {