Merge pull request #208829 from microsoft/merogge/tab-focus

set tab focus when editable widget focused
This commit is contained in:
Megan Rogge 2024-03-26 13:04:28 -07:00 committed by GitHub
commit 1d122e94cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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) {