mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-3758] 880526 modal is closed focus is not returned to trigger in the create new menu (#2809)
* ACS-3758 Return focus to New button after closing dialog opened from New menu * ACS-3758 Fixed unit tests
This commit is contained in:
parent
692952aa31
commit
43b96fc796
@ -237,6 +237,7 @@ export class ContentManagementService {
|
||||
if (node) {
|
||||
this.store.dispatch(new ReloadDocumentListAction());
|
||||
}
|
||||
ContentManagementService.focusCreateMenuButton();
|
||||
});
|
||||
}
|
||||
|
||||
@ -277,6 +278,7 @@ export class ContentManagementService {
|
||||
if (node) {
|
||||
this.appHookService.libraryCreated.next(node);
|
||||
}
|
||||
ContentManagementService.focusCreateMenuButton();
|
||||
}),
|
||||
map((node: SiteEntry) => {
|
||||
if (node && node.entry && node.entry.guid) {
|
||||
@ -1077,4 +1079,8 @@ export class ContentManagementService {
|
||||
.onAction()
|
||||
.subscribe(() => this.undoMoveNodes(moveResponse, initialParentId));
|
||||
}
|
||||
|
||||
private static focusCreateMenuButton(): void {
|
||||
document.querySelector<HTMLElement>('app-create-menu button').focus();
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ describe('NodeTemplateService', () => {
|
||||
store = TestBed.inject(Store);
|
||||
dialog = TestBed.inject(MatDialog);
|
||||
nodeTemplateService = TestBed.inject(NodeTemplateService);
|
||||
spyOn(document, 'querySelector').and.returnValue(document.createElement('button'));
|
||||
});
|
||||
|
||||
it('should open dialog with parent node `id` as data property', fakeAsync(() => {
|
||||
|
@ -116,11 +116,13 @@ export class NodeTemplateService {
|
||||
}
|
||||
|
||||
createTemplateDialog(node: Node): MatDialogRef<CreateFromTemplateDialogComponent> {
|
||||
return this.dialog.open(CreateFromTemplateDialogComponent, {
|
||||
const dialog = this.dialog.open(CreateFromTemplateDialogComponent, {
|
||||
data: node,
|
||||
panelClass: 'aca-create-from-template-dialog',
|
||||
width: '630px'
|
||||
});
|
||||
dialog.afterClosed().subscribe(() => NodeTemplateService.focusCreateMenuButton());
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private transformNode(node: MinimalNode): MinimalNode {
|
||||
@ -144,6 +146,7 @@ export class NodeTemplateService {
|
||||
|
||||
private close() {
|
||||
this.dialog.closeAll();
|
||||
NodeTemplateService.focusCreateMenuButton();
|
||||
}
|
||||
|
||||
private title(selectionType: string) {
|
||||
@ -162,4 +165,8 @@ export class NodeTemplateService {
|
||||
private getPathElements(node: Node): PathElement[] {
|
||||
return node.path.elements.filter((pathElement) => !this.rootNode.path.elements.some((rootPathElement) => pathElement.id === rootPathElement.id));
|
||||
}
|
||||
|
||||
private static focusCreateMenuButton(): void {
|
||||
document.querySelector<HTMLElement>('app-create-menu button').focus();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user