Bug/accessibility - Focus related issues (#6859)

* fix for https://github.com/microsoft/azuredatastudio/issues/6798

* fix for https://github.com/microsoft/azuredatastudio/issues/6851
This commit is contained in:
Udeesha Gautam
2019-08-22 10:29:27 -07:00
committed by GitHub
parent 09552c5f15
commit 854508e940
7 changed files with 40 additions and 8 deletions

View File

@@ -130,14 +130,22 @@ export class DialogPane extends Disposable implements IThemable {
});
}
public show(): void {
public show(focus: boolean = false): void {
this._body.classList.remove('dialogModal-hidden');
if (focus) {
this.focus();
}
}
public hide(): void {
this._body.classList.add('dialogModal-hidden');
}
private focus(): void {
let focusedElement = <HTMLElement>this._body.querySelector('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])');
focusedElement ? focusedElement.focus() : this._body.focus();
}
/**
* Called by the theme registry on theme change to style the component
*/