Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
switched back to using id instead of waitcmp
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbaud-conorwright committed Dec 11, 2018
1 parent 6ff1289 commit c34ba87
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
31 changes: 15 additions & 16 deletions src/app/public/modules/wait/wait-adapter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import {
OnDestroy
} from '@angular/core';

import {
SkyWaitComponent
} from './wait.component';

@Injectable()
export class SkyWaitAdapterService implements OnDestroy {
private static isPageWaitActive: boolean = false;
Expand Down Expand Up @@ -37,7 +33,7 @@ export class SkyWaitAdapterService implements OnDestroy {
isFullPage: boolean,
isWaiting: boolean,
isNonBlocking = false,
waitCmp: SkyWaitComponent = undefined
id?: string
): void {
let busyEl = isFullPage ? document.body : waitEl.nativeElement.parentElement;
let state = isWaiting ? 'true' : undefined;
Expand All @@ -58,14 +54,17 @@ export class SkyWaitAdapterService implements OnDestroy {
'keydown',
(event: KeyboardEvent) => {
if (event.key.toLowerCase() === 'tab') {
(event.target as any).blur();
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
this.clearDocumentFocus();
let focussable = this.getFocussableElements();
let edgeElem: any = focussable[focussable.length - 1];
if (event.shiftKey) {
edgeElem = focussable[0];
}
edgeElem.focus({
preventScroll: true
});
}
});
SkyWaitAdapterService.busyElements[waitCmp.id] = {
SkyWaitAdapterService.busyElements[id] = {
listener: endListenerFunc,
busyEl: undefined
};
Expand All @@ -74,7 +73,7 @@ export class SkyWaitAdapterService implements OnDestroy {
busyEl,
'focusin',
(event: KeyboardEvent) => {
if (!waitCmp.isNonBlocking) {
if (!isNonBlocking) {
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
Expand All @@ -89,7 +88,7 @@ export class SkyWaitAdapterService implements OnDestroy {
}
}
});
SkyWaitAdapterService.busyElements[waitCmp.id] = {
SkyWaitAdapterService.busyElements[id] = {
listener: endListenerFunc,
busyEl: busyEl
};
Expand All @@ -98,9 +97,9 @@ export class SkyWaitAdapterService implements OnDestroy {
if (isFullPage) {
SkyWaitAdapterService.isPageWaitActive = false;
}
if (waitCmp.id in SkyWaitAdapterService.busyElements) {
SkyWaitAdapterService.busyElements[waitCmp.id].listener();
delete SkyWaitAdapterService.busyElements[waitCmp.id];
if (id in SkyWaitAdapterService.busyElements) {
SkyWaitAdapterService.busyElements[id].listener();
delete SkyWaitAdapterService.busyElements[id];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/public/modules/wait/wait.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class SkyWaitComponent implements OnInit {
this.isFullPage,
value,
this.isNonBlocking,
this
this.id
);

this._isWaiting = value;
Expand Down

0 comments on commit c34ba87

Please sign in to comment.