@absolutejs/beacon 0.6.30 → 0.6.32
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 +17 -8
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1952,7 +1952,8 @@ var createBeacon = (options) => {
|
|
|
1952
1952
|
if (overflowX === "auto" || overflowX === "scroll")
|
|
1953
1953
|
return;
|
|
1954
1954
|
if (overflowX === "hidden" || overflowX === "clip") {
|
|
1955
|
-
const
|
|
1955
|
+
const horizontalContentWidth = Math.max(element.clientWidth, rect.width);
|
|
1956
|
+
const clipPx = element.scrollWidth - horizontalContentWidth;
|
|
1956
1957
|
if (clipPx > LAYOUT_OVERFLOW_CONTAINER_TOLERANCE_PX && style.textOverflow !== "ellipsis") {
|
|
1957
1958
|
reportOverflow(element, "clipped", "content is cut by overflow hidden", clipPx);
|
|
1958
1959
|
}
|
|
@@ -2887,18 +2888,25 @@ var createBeacon = (options) => {
|
|
|
2887
2888
|
});
|
|
2888
2889
|
}
|
|
2889
2890
|
if (signals.scrollJail !== false) {
|
|
2891
|
+
const MODAL_SCROLL_OWNER_SELECTOR = '[aria-modal="true"], dialog[open]';
|
|
2892
|
+
const isScrollable = (node) => {
|
|
2893
|
+
const overflowY = window.getComputedStyle(node).overflowY;
|
|
2894
|
+
return (overflowY === "auto" || overflowY === "scroll") && node.scrollHeight > node.clientHeight + 1;
|
|
2895
|
+
};
|
|
2890
2896
|
const nearestScrollable = (start) => {
|
|
2891
2897
|
let node = start;
|
|
2892
2898
|
while (node !== null && node !== document.body) {
|
|
2893
|
-
|
|
2894
|
-
const overflowY = style.overflowY;
|
|
2895
|
-
if ((overflowY === "auto" || overflowY === "scroll") && node.scrollHeight > node.clientHeight + 1) {
|
|
2899
|
+
if (isScrollable(node))
|
|
2896
2900
|
return node;
|
|
2897
|
-
}
|
|
2898
2901
|
node = node.parentElement;
|
|
2899
2902
|
}
|
|
2900
2903
|
return null;
|
|
2901
2904
|
};
|
|
2905
|
+
const modalOwnedScroller = (modal) => {
|
|
2906
|
+
const candidates = Array.from(modal.querySelectorAll("*")).filter(isScrollable);
|
|
2907
|
+
const outermost = candidates.filter((candidate) => !candidates.some((other) => other !== candidate && other.contains(candidate)));
|
|
2908
|
+
return outermost.length === 1 ? outermost[0] ?? null : null;
|
|
2909
|
+
};
|
|
2902
2910
|
let jailBurst = [];
|
|
2903
2911
|
let jailScroller = null;
|
|
2904
2912
|
let jailSettleTimer;
|
|
@@ -2921,7 +2929,8 @@ var createBeacon = (options) => {
|
|
|
2921
2929
|
return;
|
|
2922
2930
|
}
|
|
2923
2931
|
const target = event.target instanceof Element ? event.target : null;
|
|
2924
|
-
const
|
|
2932
|
+
const modal = target?.closest(MODAL_SCROLL_OWNER_SELECTOR) ?? null;
|
|
2933
|
+
const scroller = nearestScrollable(target) ?? (modal === null ? null : modalOwnedScroller(modal)) ?? document.scrollingElement;
|
|
2925
2934
|
if (!(scroller instanceof Element)) {
|
|
2926
2935
|
jailBurst = [];
|
|
2927
2936
|
return;
|
|
@@ -2961,7 +2970,7 @@ var createBeacon = (options) => {
|
|
|
2961
2970
|
const canStillMove = scrollingDown ? scroller.scrollTop + scroller.clientHeight < scroller.scrollHeight - SCROLL_JAIL_BOUNDARY_TOLERANCE_PX : scroller.scrollTop > SCROLL_JAIL_BOUNDARY_TOLERANCE_PX;
|
|
2962
2971
|
if (!canStillMove)
|
|
2963
2972
|
return;
|
|
2964
|
-
if (viewportCoveredByOverlay())
|
|
2973
|
+
if (viewportCoveredByOverlay() && (modal === null || !modal.contains(scroller)))
|
|
2965
2974
|
return;
|
|
2966
2975
|
const descriptor = describeElement(scroller);
|
|
2967
2976
|
if (reportedScrollers.has(descriptor))
|
|
@@ -3954,5 +3963,5 @@ export {
|
|
|
3954
3963
|
BEACON_ATTRIBUTE
|
|
3955
3964
|
};
|
|
3956
3965
|
|
|
3957
|
-
//# debugId=
|
|
3966
|
+
//# debugId=1440495DE8455F0364756E2164756E21
|
|
3958
3967
|
//# sourceMappingURL=index.js.map
|