add aria description (#19734)

* add aria description

* type check
This commit is contained in:
Alan Ren
2022-06-15 14:46:49 -07:00
committed by GitHub
parent 1bf99b0802
commit c75e95599f
7 changed files with 38 additions and 6 deletions

View File

@@ -40,6 +40,7 @@ export interface ISelectBoxDelegate extends IDisposable {
export interface ISelectBoxOptions {
useCustomDrawn?: boolean;
ariaLabel?: string;
ariaDescription?: string; // {{SQL CARBON EDIT}} - Add aria description
minBottomMargin?: number;
optionsAsChildren?: boolean;
}

View File

@@ -127,6 +127,11 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
this.selectElement.setAttribute('aria-label', this.selectBoxOptions.ariaLabel);
}
// {{SQL CARBON EDIT}}
if (typeof this.selectBoxOptions.ariaDescription === 'string') {
this.selectElement.setAttribute('aria-description', this.selectBoxOptions.ariaDescription);
}
this._onDidSelect = new Emitter<ISelectData>();
this._register(this._onDidSelect);

View File

@@ -36,6 +36,11 @@ export class SelectBoxNative extends Disposable implements ISelectBoxDelegate {
this.selectElement.setAttribute('aria-label', this.selectBoxOptions.ariaLabel);
}
// {{SQL CARBON EDIT}}
if (typeof this.selectBoxOptions.ariaDescription === 'string') {
this.selectElement.setAttribute('aria-description', this.selectBoxOptions.ariaDescription);
}
this._onDidSelect = this._register(new Emitter<ISelectData>());
this.styles = styles;