Skip to content

Commit

Permalink
Adding aria-live label support for input boxes (microsoft#6862)
Browse files Browse the repository at this point in the history
* Adding aria-live support for InputBoxes

* Adding aria-live setting for DacFx wizard InputBox control

* Dud commit to unstick Github CI
  • Loading branch information
Benjin authored Aug 22, 2019
1 parent ab9c4e0 commit 887b2bf
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions extensions/dacpac/src/wizard/api/dacFxConfigPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export abstract class DacFxConfigPage extends BasePage {
if (!(this.instance.selectedOperation === Operation.deploy && !this.model.upgradeExisting)) {
this.model.database = values[0].name;
}
// filename shouldn't change for deploy because the file exists and isn't being generated like for extract and export
// filename shouldn't change for deploy because the file exists and isn't being generated as for extract and export
if (this.instance.selectedOperation !== Operation.deploy) {
this.model.filePath = this.generateFilePathFromDatabaseAndTimestamp();
this.fileTextBox.value = this.model.filePath;
Expand All @@ -156,7 +156,8 @@ export abstract class DacFxConfigPage extends BasePage {
component => isValidBasename(component.value)
)
.withProperties({
required: true
required: true,
ariaLive: 'polite'
}).component();

this.fileTextBox.ariaLabel = localize('dacfx.fileLocationAriaLabel', "File Location");
Expand Down
1 change: 1 addition & 0 deletions src/sql/azdata.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2890,6 +2890,7 @@ declare module 'azdata' {
export interface InputBoxProperties extends ComponentProperties {
value?: string;
ariaLabel?: string;
ariaLive?: string;
placeHolder?: string;
inputType?: InputBoxInputType;
required?: boolean;
Expand Down
4 changes: 4 additions & 0 deletions src/sql/base/browser/ui/inputBox/inputBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export class InputBox extends vsInputBox {
}
}

public set ariaLive(value: string) {
this.element.setAttribute('aria-live', value);
}

public isEnabled(): boolean {
return !this.inputElement.hasAttribute('disabled');
}
Expand Down
7 changes: 7 additions & 0 deletions src/sql/workbench/api/common/extHostModelView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,13 @@ class InputBoxWrapper extends ComponentWrapper implements azdata.InputBoxCompone
this.setProperty('ariaLabel', v);
}

public get ariaLive(): string {
return this.properties['ariaLive'];
}
public set ariaLive(v: string) {
this.setProperty('ariaLabel', v);
}

public get placeHolder(): string {
return this.properties['placeHolder'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ export default class InputBoxComponent extends ComponentBase implements ICompone
}
}

if (this.ariaLive) {
input.ariaLive = this.ariaLive;
}

input.inputElement.required = this.required;
}
Expand All @@ -226,6 +229,10 @@ export default class InputBoxComponent extends ComponentBase implements ICompone
this.setPropertyFromUI<azdata.InputBoxProperties, string>((props, value) => props.ariaLabel = value, newValue);
}

public get ariaLive() {
return this.getPropertyOrDefault<azdata.InputBoxProperties, string>((props) => props.ariaLive, '');
}

public get placeHolder(): string {
return this.getPropertyOrDefault<azdata.InputBoxProperties, string>((props) => props.placeHolder, '');
}
Expand Down

0 comments on commit 887b2bf

Please sign in to comment.