@angular/cdk 11.2.12 → 11.2.13

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.
@@ -1557,7 +1557,12 @@
1557
1557
  }
1558
1558
  };
1559
1559
  CdkTrapFocus.prototype._captureFocus = function () {
1560
- this._previouslyFocusedElement = this._document.activeElement;
1560
+ var _a, _b;
1561
+ // If the `activeElement` is inside a shadow root, `document.activeElement` will
1562
+ // point to the shadow root so we have to descend into it ourselves.
1563
+ var activeElement = (_a = this._document) === null || _a === void 0 ? void 0 : _a.activeElement;
1564
+ this._previouslyFocusedElement =
1565
+ ((_b = activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot) === null || _b === void 0 ? void 0 : _b.activeElement) || activeElement;
1561
1566
  this.focusTrap.focusInitialElementWhenReady();
1562
1567
  };
1563
1568
  return CdkTrapFocus;