@m3e/core 1.2.2 → 1.3.0

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.
package/dist/a11y.js CHANGED
@@ -1650,10 +1650,13 @@ let M3eFocusTrapElement = class M3eFocusTrapElement extends Disabled(LitElement)
1650
1650
  };
1651
1651
  _M3eFocusTrapElement_instances = new WeakSet();
1652
1652
  _M3eFocusTrapElement_onFocus = function _M3eFocusTrapElement_onFocus(e) {
1653
+ function matchesRelatedTarget(relatedTarget, test) {
1654
+ return relatedTarget === test || relatedTarget instanceof HTMLElement && relatedTarget.shadowRoot !== null && relatedTarget.shadowRoot.contains(test);
1655
+ }
1653
1656
  const [first, last] = __classPrivateFieldGet(this, _M3eFocusTrapElement_instances, "m", _M3eFocusTrapElement_getFirstAndLastFocusableChild).call(this);
1654
1657
  const isFirst = e?.target === this._firstTrap;
1655
- const fromFirst = e.relatedTarget === first;
1656
- const fromLast = e.relatedTarget === last;
1658
+ const fromFirst = matchesRelatedTarget(e.relatedTarget, first);
1659
+ const fromLast = matchesRelatedTarget(e.relatedTarget, last);
1657
1660
  const fromOutside = !fromFirst && !fromLast;
1658
1661
  if (!isFirst && fromLast || isFirst && fromOutside) {
1659
1662
  first?.focus();