mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4953] Uploader - confirmation dialog actions should return focus to the upload dialog (#5148)
* trap confirmation dialog * focus dialog when not in confirmation state * test
This commit is contained in:
committed by
Eugenio Romano
parent
b1bccdb0e3
commit
1d7ef62095
@@ -107,7 +107,7 @@
|
|||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<footer class="adf-upload-dialog__actions"
|
<footer class="adf-upload-dialog__actions"
|
||||||
*ngIf="isConfirmation">
|
*ngIf="isConfirmation" cdkTrapFocus cdkTrapFocusAutoCapture>
|
||||||
<button
|
<button
|
||||||
id="adf-upload-dialog-cancel"
|
id="adf-upload-dialog-cancel"
|
||||||
[attr.aria-label]="'ADF_FILE_UPLOAD.ARIA-LABEL.CONFIRMATION.CANCEL' | translate"
|
[attr.aria-label]="'ADF_FILE_UPLOAD.ARIA-LABEL.CONFIRMATION.CANCEL' | translate"
|
||||||
|
@@ -164,6 +164,26 @@ describe('FileUploadingDialogComponent', () => {
|
|||||||
|
|
||||||
expect(component.isDialogMinimized).toBe(false);
|
expect(component.isDialogMinimized).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should focus on dialog when coming from confirmation', fakeAsync(() => {
|
||||||
|
uploadService.addToQueue(...fileList);
|
||||||
|
uploadService.uploadFilesInTheQueue(emitter);
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
tick(100);
|
||||||
|
|
||||||
|
component.toggleConfirmation();
|
||||||
|
fixture.detectChanges();
|
||||||
|
tick(100);
|
||||||
|
|
||||||
|
expect(document.activeElement.id).not.toBe('upload-dialog');
|
||||||
|
|
||||||
|
component.toggleConfirmation();
|
||||||
|
fixture.detectChanges();
|
||||||
|
tick(100);
|
||||||
|
|
||||||
|
expect(document.activeElement.id).toBe('upload-dialog');
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('cancelAllUploads()', () => {
|
describe('cancelAllUploads()', () => {
|
||||||
|
@@ -153,6 +153,10 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
|||||||
toggleConfirmation() {
|
toggleConfirmation() {
|
||||||
this.isConfirmation = !this.isConfirmation;
|
this.isConfirmation = !this.isConfirmation;
|
||||||
|
|
||||||
|
if (!this.isConfirmation) {
|
||||||
|
this.dialogActive.next();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isDialogMinimized) {
|
if (this.isDialogMinimized) {
|
||||||
this.isDialogMinimized = false;
|
this.isDialogMinimized = false;
|
||||||
}
|
}
|
||||||
@@ -163,7 +167,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
cancelAllUploads() {
|
cancelAllUploads() {
|
||||||
this.toggleConfirmation();
|
this.toggleConfirmation();
|
||||||
|
this.dialogActive.next();
|
||||||
this.uploadList.cancelAllFiles();
|
this.uploadList.cancelAllFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,12 +28,14 @@ import { FileUploadErrorPipe } from './pipes/file-upload-error.pipe';
|
|||||||
import { CoreModule } from '@alfresco/adf-core';
|
import { CoreModule } from '@alfresco/adf-core';
|
||||||
import { FileDraggableDirective } from './directives/file-draggable.directive';
|
import { FileDraggableDirective } from './directives/file-draggable.directive';
|
||||||
import { ToggleIconDirective } from './directives/toggle-icon.directive';
|
import { ToggleIconDirective } from './directives/toggle-icon.directive';
|
||||||
|
import { A11yModule } from '@angular/cdk/a11y';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CoreModule.forChild(),
|
CoreModule.forChild(),
|
||||||
CommonModule,
|
CommonModule,
|
||||||
MaterialModule
|
MaterialModule,
|
||||||
|
A11yModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
FileDraggableDirective,
|
FileDraggableDirective,
|
||||||
|
Reference in New Issue
Block a user