Add alert for description when modal message is shown (#16483)

* Add alert for description when modal message is shown

* Fix hygiene
This commit is contained in:
Charles Gagnon
2021-07-30 15:02:20 -07:00
committed by GitHub
parent 87cc568493
commit 3362462142
3 changed files with 8 additions and 8 deletions

View File

@@ -353,7 +353,7 @@ export class ClusterSettingsPage extends ResourceTypePage {
if (messages.length > 0) { if (messages.length > 0) {
this._model.wizard.wizardObject.message = { this._model.wizard.wizardObject.message = {
text: messages.length === 1 ? messages[0] : localize('deployCluster.ValidationError', "There are some errors on this page, click 'Show Details' to view the errors."), text: messages.length === 1 ? messages[0] : localizedConstants.multipleValidationErrors,
description: messages.length === 1 ? undefined : messages.join(EOL), description: messages.length === 1 ? undefined : messages.join(EOL),
level: azdata.window.MessageLevel.Error level: azdata.window.MessageLevel.Error
}; };

View File

@@ -5,14 +5,12 @@
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { EOL } from 'os'; import { EOL } from 'os';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { InitialVariableValues, NotebookWizardPageInfo } from '../../interfaces'; import { InitialVariableValues, NotebookWizardPageInfo } from '../../interfaces';
import { initializeWizardPage, InputComponent, InputComponentInfo, setModelValues, Validator } from '../modelViewUtils'; import { initializeWizardPage, InputComponent, InputComponentInfo, setModelValues, Validator } from '../modelViewUtils';
import { ResourceTypePage } from '../resourceTypePage'; import { ResourceTypePage } from '../resourceTypePage';
import { WizardPageInfo } from '../wizardPageInfo'; import { WizardPageInfo } from '../wizardPageInfo';
import { NotebookWizardModel } from './notebookWizardModel'; import { NotebookWizardModel } from './notebookWizardModel';
import * as loc from '../../localizedConstants';
const localize = nls.loadMessageBundle();
export class NotebookWizardPage extends ResourceTypePage { export class NotebookWizardPage extends ResourceTypePage {
@@ -135,10 +133,7 @@ export class NotebookWizardPage extends ResourceTypePage {
this.wizard.wizardObject.message = { this.wizard.wizardObject.message = {
text: messages.length === 1 text: messages.length === 1
? messages[0] ? messages[0]
: localize( : loc.multipleValidationErrors,
"wizardPage.ValidationError",
"There are some errors on this page, click 'Show Details' to view the errors."
),
description: messages.length === 1 ? undefined : messages.join(EOL), description: messages.length === 1 ? undefined : messages.join(EOL),
level: azdata.window.MessageLevel.Error, level: azdata.window.MessageLevel.Error,
}; };

View File

@@ -582,6 +582,11 @@ export abstract class Modal extends Disposable implements IThemable {
} }
DOM.removeNode(this._messageDetail!); DOM.removeNode(this._messageDetail!);
this.messagesElementVisible = !!this._messageSummaryText; this.messagesElementVisible = !!this._messageSummaryText;
// Read out the description to screen readers so they don't have to
// search around for the alert box to hear the extra information
if (description) {
alert(description);
}
this.updateExpandMessageState(); this.updateExpandMessageState();
} }
} }