Addresses accessiblility bug by converting editable dropdowns to normal when in accessible mode (#7159)

* Automatically disabling editability on extension dropdowns when in accessible mode

* correcting variable name type
This commit is contained in:
Benjin Dubishar
2019-09-12 11:08:05 -07:00
committed by GitHub
parent aaf115a5c8
commit d262ea21e3
2 changed files with 14 additions and 7 deletions

View File

@@ -60,7 +60,7 @@ export class SchemaCompareDialog {
private targetIsDacpac: boolean; private targetIsDacpac: boolean;
private connectionId: string; private connectionId: string;
private sourceDbEditable: string; private sourceDbEditable: string;
private taregtDbEditable: string; private targetDbEditable: string;
private previousSource: mssql.SchemaCompareEndpointInfo; private previousSource: mssql.SchemaCompareEndpointInfo;
private previousTarget: mssql.SchemaCompareEndpointInfo; private previousTarget: mssql.SchemaCompareEndpointInfo;
@@ -455,7 +455,7 @@ export class SchemaCompareDialog {
let sourcefilled = (this.sourceIsDacpac && this.existsDacpac(this.sourceTextBox.value)) let sourcefilled = (this.sourceIsDacpac && this.existsDacpac(this.sourceTextBox.value))
|| (!this.sourceIsDacpac && !isNullOrUndefined(this.sourceDatabaseDropdown.value) && this.sourceDatabaseDropdown.values.findIndex(x => this.matchesValue(x, this.sourceDbEditable)) !== -1); || (!this.sourceIsDacpac && !isNullOrUndefined(this.sourceDatabaseDropdown.value) && this.sourceDatabaseDropdown.values.findIndex(x => this.matchesValue(x, this.sourceDbEditable)) !== -1);
let targetfilled = (this.targetIsDacpac && this.existsDacpac(this.targetTextBox.value)) let targetfilled = (this.targetIsDacpac && this.existsDacpac(this.targetTextBox.value))
|| (!this.targetIsDacpac && !isNullOrUndefined(this.targetDatabaseDropdown.value) && this.targetDatabaseDropdown.values.findIndex(x => this.matchesValue(x, this.taregtDbEditable)) !== -1); || (!this.targetIsDacpac && !isNullOrUndefined(this.targetDatabaseDropdown.value) && this.targetDatabaseDropdown.values.findIndex(x => this.matchesValue(x, this.targetDbEditable)) !== -1);
return sourcefilled && targetfilled; return sourcefilled && targetfilled;
} }
@@ -616,7 +616,7 @@ export class SchemaCompareDialog {
} }
).component(); ).component();
this.targetDatabaseDropdown.onValueChanged((value) => { this.targetDatabaseDropdown.onValueChanged((value) => {
this.taregtDbEditable = value; this.targetDbEditable = value;
this.dialog.okButton.enabled = this.shouldEnableOkayButton(); this.dialog.okButton.enabled = this.shouldEnableOkayButton();
}); });

View File

@@ -19,6 +19,7 @@ import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@Component({ @Component({
selector: 'modelview-dropdown', selector: 'modelview-dropdown',
@@ -35,6 +36,7 @@ export default class DropDownComponent extends ComponentBase implements ICompone
@Input() modelStore: IModelStore; @Input() modelStore: IModelStore;
private _editableDropdown: Dropdown; private _editableDropdown: Dropdown;
private _selectBox: SelectBox; private _selectBox: SelectBox;
private _isInAccessibilityMode: boolean;
@ViewChild('editableDropDown', { read: ElementRef }) private _editableDropDownContainer: ElementRef; @ViewChild('editableDropDown', { read: ElementRef }) private _editableDropDownContainer: ElementRef;
@ViewChild('dropDown', { read: ElementRef }) private _dropDownContainer: ElementRef; @ViewChild('dropDown', { read: ElementRef }) private _dropDownContainer: ElementRef;
@@ -42,9 +44,14 @@ export default class DropDownComponent extends ComponentBase implements ICompone
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService, @Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(IContextViewService) private contextViewService: IContextViewService, @Inject(IContextViewService) private contextViewService: IContextViewService,
@Inject(forwardRef(() => ElementRef)) el: ElementRef @Inject(forwardRef(() => ElementRef)) el: ElementRef,
@Inject(IConfigurationService) private readonly configurationService: IConfigurationService
) { ) {
super(changeRef, el); super(changeRef, el);
if (this.configurationService) {
this._isInAccessibilityMode = this.configurationService.getValue('editor.accessibilitySupport') === 'on';
}
} }
ngOnInit(): void { ngOnInit(): void {
@@ -112,7 +119,7 @@ export default class DropDownComponent extends ComponentBase implements ICompone
this._editableDropdown.ariaLabel = this.ariaLabel; this._editableDropdown.ariaLabel = this.ariaLabel;
} }
if (this.editable) { if (this.editable && !this._isInAccessibilityMode) {
this._editableDropdown.values = this.getValues(); this._editableDropdown.values = this.getValues();
if (this.value) { if (this.value) {
this._editableDropdown.value = this.getSelectedValue(); this._editableDropdown.value = this.getSelectedValue();
@@ -186,11 +193,11 @@ export default class DropDownComponent extends ComponentBase implements ICompone
} }
public getEditableDisplay(): string { public getEditableDisplay(): string {
return this.editable ? '' : 'none'; return this.editable && !this._isInAccessibilityMode ? '' : 'none';
} }
public getNotEditableDisplay(): string { public getNotEditableDisplay(): string {
return !this.editable ? '' : 'none'; return !this.editable || this._isInAccessibilityMode ? '' : 'none';
} }
private set value(newValue: string | azdata.CategoryValue) { private set value(newValue: string | azdata.CategoryValue) {