@glowhop/core-tour 1.5.0 → 1.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @glowhop/core-tour
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e388604: Fix the popover blinking when a step scrolls its target into view on a page that scrolls inside a container rather than the document. The scroll counted as finished a few frames in, so the popover appeared mid-scroll, stepped aside as if the user were scrolling, and came back once the page stopped. The popover now waits until the target itself has stopped moving.
8
+
3
9
  ## 1.5.0
4
10
 
5
11
  ### Minor Changes
@@ -359,7 +359,13 @@ export declare class DomTourViewDriver<T> implements TourViewDriver<T> {
359
359
  /** Scrolls the target in as the step asks, and returns the settle wait as `beginTargetScroll` does. */
360
360
  private scrollTargetIntoView;
361
361
  /**
362
- * Resolves once the scroller has held still for a couple of frames.
362
+ * Resolves once the scroller, and the target it carries, have held still for
363
+ * a couple of frames.
364
+ *
365
+ * The target's own position is watched alongside the document's offset: a
366
+ * page that scrolls inside a container rather than the document moves the
367
+ * target while `scrollingElement` sits at zero, and would otherwise read as
368
+ * settled a few frames in, presenting the popover mid-scroll.
363
369
  *
364
370
  * Deliberately not the `scrollend` event: Safari only fires it from 18.2, so
365
371
  * older versions would fall through to the safety timeout on every step, and
package/index.js CHANGED
@@ -3225,6 +3225,7 @@ class DomTourViewDriver {
3225
3225
  let timeout = null;
3226
3226
  let left = scroller.scrollLeft;
3227
3227
  let top = scroller.scrollTop;
3228
+ let rect = target.getBoundingClientRect();
3228
3229
  let stillFrames = -SCROLL_SETTLE_GRACE_FRAMES;
3229
3230
  const finish = (error) => {
3230
3231
  if (frame !== null)
@@ -3249,9 +3250,11 @@ class DomTourViewDriver {
3249
3250
  frame = null;
3250
3251
  const nextLeft = scroller.scrollLeft;
3251
3252
  const nextTop = scroller.scrollTop;
3252
- const still = Math.abs(nextLeft - left) <= SCROLL_SETTLE_EPSILON && Math.abs(nextTop - top) <= SCROLL_SETTLE_EPSILON;
3253
+ const nextRect = target.getBoundingClientRect();
3254
+ const still = Math.abs(nextLeft - left) <= SCROLL_SETTLE_EPSILON && Math.abs(nextTop - top) <= SCROLL_SETTLE_EPSILON && Math.abs(nextRect.left - rect.left) <= SCROLL_SETTLE_EPSILON && Math.abs(nextRect.top - rect.top) <= SCROLL_SETTLE_EPSILON;
3253
3255
  left = nextLeft;
3254
3256
  top = nextTop;
3257
+ rect = nextRect;
3255
3258
  stillFrames = still ? stillFrames + 1 : 0;
3256
3259
  if (stillFrames >= SCROLL_SETTLE_STILL_FRAMES)
3257
3260
  return finish();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glowhop/core-tour",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Framework-agnostic product tour engine for GlowTour.js: the tour controller and DOM runtime behind onboarding tours in any framework.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://glowtour.dev/",