@skyux/indicators 6.10.0 → 6.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1360,10 +1360,16 @@ class SkyWaitAdapterService {
1360
1360
  : waitEl.nativeElement.parentElement;
1361
1361
  if (!isNonBlocking) {
1362
1362
  if (isWaiting) {
1363
+ let restoreFocusElement = undefined;
1364
+ let restoreFocusCheckElement = undefined;
1363
1365
  this.renderer.setAttribute(busyEl, 'aria-busy', 'true');
1364
1366
  // Remove focus from page when full page blocking wait
1365
1367
  if (isFullPage || busyEl.contains(document.activeElement)) {
1368
+ if (document.activeElement !== document.body) {
1369
+ restoreFocusElement = document.activeElement;
1370
+ }
1366
1371
  this.clearDocumentFocus();
1372
+ restoreFocusCheckElement = document.activeElement;
1367
1373
  }
1368
1374
  if (isFullPage) {
1369
1375
  SkyWaitAdapterService.isPageWaitActive = true;
@@ -1383,6 +1389,8 @@ class SkyWaitAdapterService {
1383
1389
  SkyWaitAdapterService.busyElements[waitComponentId] = {
1384
1390
  listener: endListenerFunc,
1385
1391
  busyEl: undefined,
1392
+ restoreFocusElement,
1393
+ restoreFocusCheckElement,
1386
1394
  };
1387
1395
  }
1388
1396
  else {
@@ -1406,6 +1414,8 @@ class SkyWaitAdapterService {
1406
1414
  SkyWaitAdapterService.busyElements[waitComponentId] = {
1407
1415
  listener: endListenerFunc,
1408
1416
  busyEl: busyEl,
1417
+ restoreFocusElement,
1418
+ restoreFocusCheckElement,
1409
1419
  };
1410
1420
  }
1411
1421
  }
@@ -1416,6 +1426,13 @@ class SkyWaitAdapterService {
1416
1426
  }
1417
1427
  if (waitComponentId in SkyWaitAdapterService.busyElements) {
1418
1428
  SkyWaitAdapterService.busyElements[waitComponentId].listener();
1429
+ // If there is a restore focus element and the focus has not moved, restore focus.
1430
+ if (SkyWaitAdapterService.busyElements[waitComponentId]
1431
+ .restoreFocusElement &&
1432
+ SkyWaitAdapterService.busyElements[waitComponentId]
1433
+ .restoreFocusCheckElement === document.activeElement) {
1434
+ SkyWaitAdapterService.busyElements[waitComponentId].restoreFocusElement.focus();
1435
+ }
1419
1436
  delete SkyWaitAdapterService.busyElements[waitComponentId];
1420
1437
  }
1421
1438
  }