fix keyboard focus issues (#16206)

This commit is contained in:
Alan Ren
2021-07-16 13:27:15 -07:00
committed by GitHub
parent 3847271e67
commit eed792f3db
19 changed files with 69 additions and 86 deletions

View File

@@ -382,12 +382,9 @@ export abstract class Modal extends Disposable implements IThemable {
* Set focusable elements in the modal dialog
*/
public setInitialFocusedElement() {
// Try to find focusable element in dialog pane rather than overall container. _modalBodySection contains items in the pane for a wizard.
// This ensures that we are setting the focus on a useful element in the form when possible.
const focusableElements = getFocusableElements(this._modalBodySection ?? this._bodyContainer!);
if (focusableElements && focusableElements.length > 0) {
(<HTMLElement>focusableElements[0]).focus();
const focusableElements = getFocusableElements(this._modalDialog!);
if (focusableElements?.length > 0) {
focusableElements[0].focus();
}
}

View File

@@ -56,6 +56,10 @@ export abstract class ComponentBase<TPropertyBag extends azdata.ComponentPropert
this.modelStore.registerComponent(this);
this._validations.push(() => this.modelStore.validate(this));
}
this.fireEvent({
eventType: ComponentEventType.onComponentLoaded,
args: undefined
});
}
abstract ngAfterViewInit(): void;