Skip to content

Commit 74c50b0

Browse files
authored
Merge pull request microsoft#183305 from microsoft/aiday/internalIssue4027
Reading out placeholder when no text written in interactive editor
2 parents 41a3e40 + a0a3a66 commit 74c50b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorWidget.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import { assertType } from 'vs/base/common/types';
5252
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
5353
import { ExpansionState } from 'vs/workbench/contrib/interactiveEditor/browser/interactiveEditorSession';
5454
import { IdleValue } from 'vs/base/common/async';
55+
import * as aria from 'vs/base/browser/ui/aria/aria';
5556

5657
const defaultAriaLabel = localize('aria-label', "Interactive Editor Input");
5758

@@ -246,6 +247,7 @@ export class InteractiveEditorWidget {
246247
const hasFocus = this._inputEditor.hasWidgetFocus();
247248
this._ctxInputEditorFocused.set(hasFocus);
248249
this._elements.content.classList.toggle('synthetic-focus', hasFocus);
250+
this.readPlaceholder();
249251
};
250252
this._store.add(this._inputEditor.onDidFocusEditorWidget(updateFocused));
251253
this._store.add(this._inputEditor.onDidBlurEditorWidget(updateFocused));
@@ -271,6 +273,7 @@ export class InteractiveEditorWidget {
271273
const hasText = this._inputModel.getValueLength() > 0;
272274
this._elements.placeholder.classList.toggle('hidden', hasText);
273275
this._ctxInputEmpty.set(!hasText);
276+
this.readPlaceholder();
274277

275278
const contentHeight = this._inputEditor.getContentHeight();
276279
if (contentHeight !== currentContentHeight && this._lastDim) {
@@ -435,6 +438,13 @@ export class InteractiveEditorWidget {
435438
this._elements.placeholder.innerText = value;
436439
}
437440

441+
readPlaceholder(): void {
442+
const hasText = this._inputModel.getValueLength() > 0;
443+
if (!hasText) {
444+
aria.status(this._elements.placeholder.innerText);
445+
}
446+
}
447+
438448
updateToolbar(show: boolean) {
439449
this._elements.statusToolbar.classList.toggle('hidden', !show);
440450
this._elements.feedbackToolbar.classList.toggle('hidden', !show);

0 commit comments

Comments
 (0)