@wistia/ui 3.4.0-beta.1b6a2e2d.3526ea7 → 3.4.0-beta.4e4e9bca.1a3d3d6

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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v3.4.0-beta.1b6a2e2d.3526ea7
3
+ * @license @wistia/ui v3.4.0-beta.4e4e9bca.1a3d3d6
4
4
  *
5
5
  * Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
6
6
  *
@@ -1498,24 +1498,6 @@ const isTabbableElement = (element) => {
1498
1498
  return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
1499
1499
  };
1500
1500
  const findTabbableDescendants = (element) => [...element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)].filter((el) => isTabbableElement(el));
1501
- const splitIdList = (value) => (value ?? "").split(/\s+/).filter((id) => id !== "");
1502
- const getLinkedIds = (owner) => [...splitIdList(owner.getAttribute("aria-owns")), ...owner.getAttribute("aria-expanded") === "true" ? splitIdList(owner.getAttribute("aria-controls")) : []];
1503
- /**
1504
- * The parts of the page a trap treats as its own: `container`, plus every popup that
1505
- * something in the trap has opened. Popups such as Menu, Popover and Select render in a
1506
- * portal at the end of <body>, outside the trap in the DOM. They are linked back to it by
1507
- * `aria-owns` or by an expanded `aria-controls`. Links are followed transitively, so a
1508
- * submenu opened from that menu counts too.
1509
- */
1510
- const getTrapRegions = (container) => {
1511
- const regions = [container];
1512
- for (const region of regions) for (const owner of region.querySelectorAll("[aria-owns], [aria-controls]")) for (const id of getLinkedIds(owner)) {
1513
- const linked = document.getElementById(id);
1514
- if (linked !== null && !regions.includes(linked)) regions.push(linked);
1515
- }
1516
- return regions;
1517
- };
1518
- const isInsideTrap = (container, target) => target !== null && (container.contains(target) || getTrapRegions(container).some((region) => region.contains(target)));
1519
1501
  const focusLaterElements = [];
1520
1502
  let focusElement = null;
1521
1503
  let needToFocus = false;
@@ -1526,7 +1508,7 @@ const handleFocus = () => {
1526
1508
  if (needToFocus) {
1527
1509
  needToFocus = false;
1528
1510
  if (!focusElement) return;
1529
- if (isInsideTrap(focusElement, document.activeElement)) return;
1511
+ if (focusElement.contains(document.activeElement)) return;
1530
1512
  (findTabbableDescendants(focusElement)[0] ?? focusElement).focus();
1531
1513
  }
1532
1514
  };
@@ -1566,8 +1548,7 @@ const scopeTab = (node, event) => {
1566
1548
  };
1567
1549
  const ariaHiderState = /* @__PURE__ */ new WeakMap();
1568
1550
  const createAriaHider = (containerNode, selector = "body > :not(script)") => {
1569
- const regions = getTrapRegions(containerNode);
1570
- const hiddenNodes = [...document.querySelectorAll(selector)].filter((node) => !regions.some((region) => node.contains(region)));
1551
+ const hiddenNodes = [...document.querySelectorAll(selector)].filter((node) => !node.contains(containerNode));
1571
1552
  hiddenNodes.forEach((node) => {
1572
1553
  const state = ariaHiderState.get(node);
1573
1554
  if (state) {