mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
fix select box's screen reader issues (#2462)
This commit is contained in:
@@ -69,6 +69,9 @@ export class SelectBox extends vsSelectBox {
|
|||||||
if (container) {
|
if (container) {
|
||||||
this.element = dom.append(container, $('.monaco-selectbox.idle'));
|
this.element = dom.append(container, $('.monaco-selectbox.idle'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// explicitly set the accessible role so that the screen readers can read the control type properly
|
||||||
|
this.selectElement.setAttribute('role', 'combobox');
|
||||||
}
|
}
|
||||||
|
|
||||||
public style(styles: ISelectBoxStyles): void {
|
public style(styles: ISelectBoxStyles): void {
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
container.appendChild(connectionContainer.getHTMLElement());
|
container.appendChild(connectionContainer.getHTMLElement());
|
||||||
|
|
||||||
this._bodyBuilder = new Builder(connectionContainer.getHTMLElement());
|
this._bodyBuilder = new Builder(connectionContainer.getHTMLElement());
|
||||||
this._providerTypeSelectBox = new SelectBox(this.providerTypeOptions, this.selectedProviderType, this._contextViewService);
|
const connectTypeLabel = localize('connectType', 'Connection type');
|
||||||
|
this._providerTypeSelectBox = new SelectBox(this.providerTypeOptions, this.selectedProviderType, this._contextViewService, undefined, { ariaLabel: connectTypeLabel });
|
||||||
// Recent connection tab
|
// Recent connection tab
|
||||||
let recentConnectionTab = $('.connection-recent-tab');
|
let recentConnectionTab = $('.connection-recent-tab');
|
||||||
recentConnectionTab.div({ class: 'connection-recent', id: 'recentConnection' }, (builder) => {
|
recentConnectionTab.div({ class: 'connection-recent', id: 'recentConnection' }, (builder) => {
|
||||||
@@ -182,7 +182,6 @@ export class ConnectionDialogWidget extends Modal {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this._bodyBuilder.div({ class: 'connection-type' }, (modelTableContent) => {
|
this._bodyBuilder.div({ class: 'connection-type' }, (modelTableContent) => {
|
||||||
let connectTypeLabel = localize('connectType', 'Connection type');
|
|
||||||
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
|
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
|
||||||
DialogHelper.appendInputSelectBox(
|
DialogHelper.appendInputSelectBox(
|
||||||
DialogHelper.appendRow(tableContainer, connectTypeLabel, 'connection-label', 'connection-input'), this._providerTypeSelectBox);
|
DialogHelper.appendRow(tableContainer, connectTypeLabel, 'connection-label', 'connection-input'), this._providerTypeSelectBox);
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ export class ConnectionWidget {
|
|||||||
private _databaseDropdownExpanded: boolean = false;
|
private _databaseDropdownExpanded: boolean = false;
|
||||||
private _defaultDatabaseName: string = localize('defaultDatabaseOption', '<Default>');
|
private _defaultDatabaseName: string = localize('defaultDatabaseOption', '<Default>');
|
||||||
private _loadingDatabaseName: string = localize('loadingDatabaseOption', 'Loading...');
|
private _loadingDatabaseName: string = localize('loadingDatabaseOption', 'Loading...');
|
||||||
|
private _serverGroupDisplayString: string = localize('serverGroup', 'Server group');
|
||||||
public DefaultServerGroup: IConnectionProfileGroup = {
|
public DefaultServerGroup: IConnectionProfileGroup = {
|
||||||
id: '',
|
id: '',
|
||||||
name: localize('defaultServerGroup', '<Default>'),
|
name: localize('defaultServerGroup', '<Default>'),
|
||||||
@@ -112,14 +113,14 @@ export class ConnectionWidget {
|
|||||||
} else {
|
} else {
|
||||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(Constants.sqlLogin);
|
authTypeOption.defaultValue = this.getAuthTypeDisplayName(Constants.sqlLogin);
|
||||||
}
|
}
|
||||||
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService);
|
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService, undefined, { ariaLabel: authTypeOption.displayName });
|
||||||
}
|
}
|
||||||
this._providerName = providerName;
|
this._providerName = providerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public createConnectionWidget(container: HTMLElement): void {
|
public createConnectionWidget(container: HTMLElement): void {
|
||||||
this._serverGroupOptions = [this.DefaultServerGroup];
|
this._serverGroupOptions = [this.DefaultServerGroup];
|
||||||
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService);
|
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService, undefined, { ariaLabel: this._serverGroupDisplayString });
|
||||||
this._previousGroupOption = this._serverGroupSelectBox.value;
|
this._previousGroupOption = this._serverGroupSelectBox.value;
|
||||||
this._builder = $().div({ class: 'connection-table' }, (modelTableContent) => {
|
this._builder = $().div({ class: 'connection-table' }, (modelTableContent) => {
|
||||||
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
|
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
|
||||||
@@ -218,8 +219,7 @@ export class ConnectionWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Server group
|
// Server group
|
||||||
let serverGroupLabel = localize('serverGroup', 'Server group');
|
let serverGroupBuilder = DialogHelper.appendRow(this._tableContainer, this._serverGroupDisplayString, 'connection-label', 'connection-input');
|
||||||
let serverGroupBuilder = DialogHelper.appendRow(this._tableContainer, serverGroupLabel, 'connection-label', 'connection-input');
|
|
||||||
DialogHelper.appendInputSelectBox(serverGroupBuilder, this._serverGroupSelectBox);
|
DialogHelper.appendInputSelectBox(serverGroupBuilder, this._serverGroupSelectBox);
|
||||||
|
|
||||||
let AdvancedLabel = localize('advanced', 'Advanced...');
|
let AdvancedLabel = localize('advanced', 'Advanced...');
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ export class BackupComponent {
|
|||||||
ariaLabel: LocalizedStrings.RECOVERY_MODEL
|
ariaLabel: LocalizedStrings.RECOVERY_MODEL
|
||||||
});
|
});
|
||||||
// Set backup type
|
// Set backup type
|
||||||
this.backupTypeSelectBox = new SelectBox([], '', this.contextViewService);
|
this.backupTypeSelectBox = new SelectBox([], '', this.contextViewService, undefined, { ariaLabel: this.localizedStrings.BACKUP_TYPE });
|
||||||
this.backupTypeSelectBox.render(this.backupTypeElement.nativeElement);
|
this.backupTypeSelectBox.render(this.backupTypeElement.nativeElement);
|
||||||
|
|
||||||
// Set copy-only check box
|
// Set copy-only check box
|
||||||
@@ -283,13 +283,13 @@ export class BackupComponent {
|
|||||||
this.removePathButton.title = localize('removeFile', 'Remove files');
|
this.removePathButton.title = localize('removeFile', 'Remove files');
|
||||||
|
|
||||||
// Set compression
|
// Set compression
|
||||||
this.compressionSelectBox = new SelectBox(this.compressionOptions, this.compressionOptions[0], this.contextViewService);
|
this.compressionSelectBox = new SelectBox(this.compressionOptions, this.compressionOptions[0], this.contextViewService, undefined, { ariaLabel: this.localizedStrings.SET_BACKUP_COMPRESSION });
|
||||||
this.compressionSelectBox.render(this.compressionElement.nativeElement);
|
this.compressionSelectBox.render(this.compressionElement.nativeElement);
|
||||||
|
|
||||||
// Set encryption
|
// Set encryption
|
||||||
this.algorithmSelectBox = new SelectBox(this.encryptionAlgorithms, this.encryptionAlgorithms[0], this.contextViewService);
|
this.algorithmSelectBox = new SelectBox(this.encryptionAlgorithms, this.encryptionAlgorithms[0], this.contextViewService, undefined, { ariaLabel: this.localizedStrings.ALGORITHM });
|
||||||
this.algorithmSelectBox.render(this.encryptionAlgorithmElement.nativeElement);
|
this.algorithmSelectBox.render(this.encryptionAlgorithmElement.nativeElement);
|
||||||
this.encryptorSelectBox = new SelectBox([], '', this.contextViewService);
|
this.encryptorSelectBox = new SelectBox([], '', this.contextViewService, undefined, { ariaLabel: this.localizedStrings.CERTIFICATE_OR_ASYMMETRIC_KEY });
|
||||||
this.encryptorSelectBox.render(this.encryptorElement.nativeElement);
|
this.encryptorSelectBox.render(this.encryptorElement.nativeElement);
|
||||||
|
|
||||||
// Set media
|
// Set media
|
||||||
|
|||||||
@@ -541,7 +541,7 @@ export class RestoreDialog extends Modal {
|
|||||||
});
|
});
|
||||||
|
|
||||||
inputContainer.div({ class: 'dialog-input' }, (inputCellContainer) => {
|
inputContainer.div({ class: 'dialog-input' }, (inputCellContainer) => {
|
||||||
selectBox = new SelectBox(options, selectedOption, this._contextViewService, inputCellContainer.getHTMLElement());
|
selectBox = new SelectBox(options, selectedOption, this._contextViewService, inputCellContainer.getHTMLElement(), { ariaLabel: label });
|
||||||
selectBox.render(inputCellContainer.getHTMLElement());
|
selectBox.render(inputCellContainer.getHTMLElement());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user