mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4862] Upload dialog - reading order (#5045)
* dialog container accessibility * upload container aria label translation key * focus on active upload dialog * test * add back removed aria-label
This commit is contained in:
committed by
Eugenio Romano
parent
19a17ca6e6
commit
df0bb75324
@@ -16,11 +16,11 @@
|
||||
*/
|
||||
|
||||
import { FileModel, FileUploadStatus, UploadService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { ChangeDetectorRef, Component, Input, Output, EventEmitter, OnDestroy, OnInit, ViewChild, HostBinding } from '@angular/core';
|
||||
import { ChangeDetectorRef, Component, Input, Output, EventEmitter, OnDestroy, OnInit, ViewChild, HostBinding, ElementRef } from '@angular/core';
|
||||
import { Subscription, merge, Subject } from 'rxjs';
|
||||
import { FileUploadingListComponent } from './file-uploading-list.component';
|
||||
import { Direction } from '@angular/cdk/bidi';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { takeUntil, delay } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-file-uploading-dialog',
|
||||
@@ -67,22 +67,34 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
||||
private counterSubscription: Subscription;
|
||||
private fileUploadSubscription: Subscription;
|
||||
private errorSubscription: Subscription;
|
||||
private dialogActive = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private uploadService: UploadService,
|
||||
private changeDetector: ChangeDetectorRef,
|
||||
private userPreferencesService: UserPreferencesService
|
||||
private userPreferencesService: UserPreferencesService,
|
||||
private elementRef: ElementRef
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.dialogActive
|
||||
.pipe(
|
||||
delay(100),
|
||||
takeUntil(this.onDestroy$)
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.elementRef.nativeElement.querySelector('#upload-dialog').focus();
|
||||
});
|
||||
|
||||
this.listSubscription = this.uploadService.queueChanged
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(fileList => {
|
||||
this.filesUploadingList = fileList;
|
||||
|
||||
if (this.filesUploadingList.length) {
|
||||
if (this.filesUploadingList.length && !this.isDialogActive) {
|
||||
this.isDialogActive = true;
|
||||
this.dialogActive.next();
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user