mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 09:35:39 -05:00
Bug/accessibility 5 (#7008)
* fixing 6946 and 6796(second part) * fix for https://github.com/microsoft/azuredatastudio/issues/6726 * comments cleanup * taking PR comments * adding strong border for HC focus * convert to string template
This commit is contained in:
@@ -319,13 +319,27 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
* Set focusable elements in the modal dialog
|
||||
*/
|
||||
public setFocusableElements() {
|
||||
this._focusableElements = this._bodyContainer.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]');
|
||||
// try to find focusable element in dialog pane rather than overall container
|
||||
this._focusableElements = this._modalBodySection ?
|
||||
this._modalBodySection.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]') :
|
||||
this._bodyContainer.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]');
|
||||
if (this._focusableElements && this._focusableElements.length > 0) {
|
||||
this._firstFocusableElement = <HTMLElement>this._focusableElements[0];
|
||||
this._lastFocusableElement = <HTMLElement>this._focusableElements[this._focusableElements.length - 1];
|
||||
}
|
||||
|
||||
this._focusedElementBeforeOpen = <HTMLElement>document.activeElement;
|
||||
this.focus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Focuses the modal
|
||||
* Default behavior: focus the first focusable element
|
||||
*/
|
||||
protected focus() {
|
||||
if (this._firstFocusableElement) {
|
||||
this._firstFocusableElement.focus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user