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) {
|
if (node) {
|
||||||
this.store.dispatch(new ReloadDocumentListAction());
|
this.store.dispatch(new ReloadDocumentListAction());
|
||||||
}
|
}
|
||||||
|
ContentManagementService.focusCreateMenuButton();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,6 +278,7 @@ export class ContentManagementService {
|
|||||||
if (node) {
|
if (node) {
|
||||||
this.appHookService.libraryCreated.next(node);
|
this.appHookService.libraryCreated.next(node);
|
||||||
}
|
}
|
||||||
|
ContentManagementService.focusCreateMenuButton();
|
||||||
}),
|
}),
|
||||||
map((node: SiteEntry) => {
|
map((node: SiteEntry) => {
|
||||||
if (node && node.entry && node.entry.guid) {
|
if (node && node.entry && node.entry.guid) {
|
||||||
@ -1077,4 +1079,8 @@ export class ContentManagementService {
|
|||||||
.onAction()
|
.onAction()
|
||||||
.subscribe(() => this.undoMoveNodes(moveResponse, initialParentId));
|
.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);
|
store = TestBed.inject(Store);
|
||||||
dialog = TestBed.inject(MatDialog);
|
dialog = TestBed.inject(MatDialog);
|
||||||
nodeTemplateService = TestBed.inject(NodeTemplateService);
|
nodeTemplateService = TestBed.inject(NodeTemplateService);
|
||||||
|
spyOn(document, 'querySelector').and.returnValue(document.createElement('button'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open dialog with parent node `id` as data property', fakeAsync(() => {
|
it('should open dialog with parent node `id` as data property', fakeAsync(() => {
|
||||||
|
@ -116,11 +116,13 @@ export class NodeTemplateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTemplateDialog(node: Node): MatDialogRef<CreateFromTemplateDialogComponent> {
|
createTemplateDialog(node: Node): MatDialogRef<CreateFromTemplateDialogComponent> {
|
||||||
return this.dialog.open(CreateFromTemplateDialogComponent, {
|
const dialog = this.dialog.open(CreateFromTemplateDialogComponent, {
|
||||||
data: node,
|
data: node,
|
||||||
panelClass: 'aca-create-from-template-dialog',
|
panelClass: 'aca-create-from-template-dialog',
|
||||||
width: '630px'
|
width: '630px'
|
||||||
});
|
});
|
||||||
|
dialog.afterClosed().subscribe(() => NodeTemplateService.focusCreateMenuButton());
|
||||||
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private transformNode(node: MinimalNode): MinimalNode {
|
private transformNode(node: MinimalNode): MinimalNode {
|
||||||
@ -144,6 +146,7 @@ export class NodeTemplateService {
|
|||||||
|
|
||||||
private close() {
|
private close() {
|
||||||
this.dialog.closeAll();
|
this.dialog.closeAll();
|
||||||
|
NodeTemplateService.focusCreateMenuButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
private title(selectionType: string) {
|
private title(selectionType: string) {
|
||||||
@ -162,4 +165,8 @@ export class NodeTemplateService {
|
|||||||
private getPathElements(node: Node): PathElement[] {
|
private getPathElements(node: Node): PathElement[] {
|
||||||
return node.path.elements.filter((pathElement) => !this.rootNode.path.elements.some((rootPathElement) => pathElement.id === rootPathElement.id));
|
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