[ACS-3888] Correct role for new version dialog (#7965)

* [ACS-3888] Correct role for new version dialog

* [ACS-3888] Correct role for move/copy dialog

* [ACS-3888] Unit test fix
This commit is contained in:
MichalKinas 2022-11-15 10:03:23 +01:00 committed by GitHub
parent a83e837a96
commit 39e458abb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -66,7 +66,8 @@ describe('ContentNodeSelectorComponent', () => {
keydownEvents: () => of(null),
backdropClick: () => of(null),
close: jasmine.createSpy('close'),
afterClosed: () => of(null)
afterClosed: () => of(null),
afterOpened: () => of(null)
}
}
],

View File

@ -23,6 +23,7 @@ import { Node } from '@alfresco/js-api';
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
import { NodeEntryEvent } from '../document-list/components/node.event';
import { NodeAction } from '../document-list/models/node-action.enum';
import { OverlayContainer } from '@angular/cdk/overlay';
@Component({
selector: 'adf-content-node-selector',
@ -50,6 +51,7 @@ export class ContentNodeSelectorComponent implements OnInit {
private notificationService: NotificationService,
private uploadService: UploadService,
private dialog: MatDialogRef<ContentNodeSelectorComponent>,
private overlayContainer: OverlayContainer,
@Inject(MAT_DIALOG_DATA) public data: ContentNodeSelectorComponentData) {
this.action = data.actionName ?? NodeAction.CHOOSE;
this.buttonActionName = `NODE_SELECTOR.${this.action}`;
@ -71,6 +73,10 @@ export class ContentNodeSelectorComponent implements OnInit {
this.close();
});
this.dialog.afterOpened().subscribe(() => {
this.overlayContainer.getContainerElement().setAttribute('role', 'main');
});
this.uploadService.fileUploadStarting.subscribe(() => {
this.uploadStarted = true;
});
@ -78,6 +84,7 @@ export class ContentNodeSelectorComponent implements OnInit {
close() {
this.dialog.close();
this.overlayContainer.getContainerElement().setAttribute('role', 'region');
}
onSelect(nodeList: Node[]) {

View File

@ -23,6 +23,7 @@ import { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog
import { VersionPaging, VersionsApi } from '@alfresco/js-api';
import { NewVersionUploaderData, NewVersionUploaderDialogData } from './models';
import { Observable } from 'rxjs';
import { OverlayContainer } from '@angular/cdk/overlay';
@Injectable({
providedIn: 'root'
@ -38,7 +39,8 @@ export class NewVersionUploaderService {
constructor(
private contentService: ContentService,
private apiService: AlfrescoApiService,
private dialog: MatDialog
private dialog: MatDialog,
private overlayContainer: OverlayContainer
) { }
/**
@ -72,6 +74,10 @@ export class NewVersionUploaderService {
dialogRef.componentInstance.uploadError.asObservable().subscribe(error => {
observer.error(error);
});
dialogRef.afterClosed().subscribe(() => {
this.overlayContainer.getContainerElement().setAttribute('role', 'region');
});
this.overlayContainer.getContainerElement().setAttribute('role', 'main');
});
} else {
observer.error({ value: 'OPERATION.ERROR.PERMISSION' });