@absolutejs/beacon 0.6.1 → 0.6.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.
package/dist/index.js CHANGED
@@ -673,6 +673,7 @@ var createBeacon = (options) => {
673
673
  const KEYBOARD_VIEWPORT_HEIGHT_RATIO_MAX = 0.8;
674
674
  const SCROLL_JAIL_EVENT_COUNT = 8;
675
675
  const SCROLL_JAIL_WINDOW_MS = 2000;
676
+ const SCROLL_JAIL_SETTLE_MS = 50;
676
677
  const SCROLL_JAIL_BOUNDARY_TOLERANCE_PX = 2;
677
678
  const AUTH_FAILURE_STORM_DEFAULT_COUNT = 4;
678
679
  const AUTH_FAILURE_STORM_DEFAULT_WINDOW_MS = 30000;
@@ -2581,6 +2582,7 @@ var createBeacon = (options) => {
2581
2582
  };
2582
2583
  let jailBurst = [];
2583
2584
  let jailScroller = null;
2585
+ let jailSettleTimer;
2584
2586
  const reportedScrollers = new Set;
2585
2587
  const onWheel = (event) => {
2586
2588
  if (event.ctrlKey || event.defaultPrevented || event.deltaY === 0) {
@@ -2613,16 +2615,31 @@ var createBeacon = (options) => {
2613
2615
  jailBurst = [];
2614
2616
  if (moved)
2615
2617
  return;
2616
- if (viewportCoveredByOverlay())
2617
- return;
2618
- const descriptor = describeElement(scroller);
2619
- if (reportedScrollers.has(descriptor))
2620
- return;
2621
- reportedScrollers.add(descriptor);
2622
- emitSignal(`Scroll jail — ${descriptor} has scrollable content but never moves — ${shortUrl(location.href)}`, { signal: BEACON_SIGNAL.SCROLL_JAIL, target: descriptor });
2618
+ const startingPosition = first.position;
2619
+ if (jailSettleTimer !== undefined)
2620
+ clearTimeout(jailSettleTimer);
2621
+ jailSettleTimer = setTimeout(() => {
2622
+ jailSettleTimer = undefined;
2623
+ if (!scroller.isConnected || scroller.scrollTop !== startingPosition)
2624
+ return;
2625
+ const canStillMove = scrollingDown ? scroller.scrollTop + scroller.clientHeight < scroller.scrollHeight - SCROLL_JAIL_BOUNDARY_TOLERANCE_PX : scroller.scrollTop > SCROLL_JAIL_BOUNDARY_TOLERANCE_PX;
2626
+ if (!canStillMove)
2627
+ return;
2628
+ if (viewportCoveredByOverlay())
2629
+ return;
2630
+ const descriptor = describeElement(scroller);
2631
+ if (reportedScrollers.has(descriptor))
2632
+ return;
2633
+ reportedScrollers.add(descriptor);
2634
+ emitSignal(`Scroll jail — ${descriptor} has scrollable content but never moves — ${shortUrl(location.href)}`, { signal: BEACON_SIGNAL.SCROLL_JAIL, target: descriptor });
2635
+ }, SCROLL_JAIL_SETTLE_MS);
2623
2636
  };
2624
2637
  document.addEventListener("wheel", onWheel, { passive: true });
2625
- cleanups.push(() => document.removeEventListener("wheel", onWheel));
2638
+ cleanups.push(() => {
2639
+ document.removeEventListener("wheel", onWheel);
2640
+ if (jailSettleTimer !== undefined)
2641
+ clearTimeout(jailSettleTimer);
2642
+ });
2626
2643
  }
2627
2644
  if (signals.thrashedCursors !== false) {
2628
2645
  const reversalThreshold = signals.thrashedCursorReversals ?? THRASHED_CURSOR_DEFAULT_REVERSALS;
@@ -3502,5 +3519,5 @@ export {
3502
3519
  BEACON_ATTRIBUTE
3503
3520
  };
3504
3521
 
3505
- //# debugId=3AAF126503C46C2364756E2164756E21
3522
+ //# debugId=E1FC30A16480777864756E2164756E21
3506
3523
  //# sourceMappingURL=index.js.map