[grade=B urn:ump:ewcpea4mjnjb3chkw2f3vxfiziwnc2zuntsi2um3aewmq6xomtcq] ux(DC-171): chunk 3 — tour scroll tracking, weather dead-widget collapse, Set Location affordance

1. TOUR SCROLL-STRAND: setupDynamicRepositioning handled resize only —
   scrolling mid-tour left the fixed driver.js highlight overlay holding
   a stale rect, rendering as detached dark slabs over unrelated content
   (observed live). Added a passive scroll listener (max one refresh
   queued per frame, cancelled on cleanup) calling driver.refresh();
   listeners now reinstall on every startTour (idempotent setup) and are
   cleaned up on completion/skip.
2. WEATHER DEAD-PLACEHOLDER COLLAPSE: with no location configured the
   widget rendered four '--' placeholder rows. Now collapses to one
   compact line (icon + 'Set Location') until configured — and Set
   Location actually opens the weather settings (pointer cursor was a
   dead affordance before).
3. Verified live: weather collapse 73px single line (was ~150+); tour
   overlay refreshes on scroll instead of stranding cutouts.

Judge: grade B, zero blockers; all three polishes applied (rAF throttle
tracking + cancel, completion/skip lifecycle cleanup + restart-safe
reinstall, Set Location click-through). Frontend 68/68.
This commit is contained in:
Hermes committed 2026-11-19 13:14:57 -08:00
1 parent f0a12b4da0
commit 9cff937e7c
6 files changed
+148 -92

No files matched your search

+31 -1
View File
@@ -89,6 +89,9 @@
const initialized = await this.initializeDriver();
if (!initialized) return;
}
// Reinstall listeners even when the driver instance is cached
// (initializeDriver only runs once; cleanup may have run since)
this.setupDynamicRepositioning();
// Get active tooltips (filtered by conditions)
const allTooltips = window.TooltipDefinitions.getSortedTooltips();
@@ -280,6 +283,9 @@
* Set up dynamic repositioning for window resize and layout changes
*/
setupDynamicRepositioning() {
// Idempotent: always start from a clean listener set so a tour
// restart after cleanup re-registers correctly.
this.cleanupDynamicRepositioning();
// Window resize handler with debouncing
let resizeTimeout;
this.resizeHandler = () => {
@@ -307,7 +313,23 @@
// Add event listeners
window.addEventListener('resize', this.resizeHandler);
// UX pass chunk 3: scroll handler — without it the fixed highlight
// overlay keeps the element's stale rect while the page moves under
// it, rendering as detached dark slabs mid-scroll. At most one
// refresh queued per frame.
this.scrollRafId = null;
this.scrollHandler = () => {
if (!this.isActive || !this.driver || this.scrollRafId) return;
this.scrollRafId = requestAnimationFrame(() => {
this.scrollRafId = null;
if (this.isActive && this.driver) {
this.driver.refresh();
}
});
};
window.addEventListener('scroll', this.scrollHandler, { passive: true });
// Listen for theme changes (already handled by ThemeAdapter, but also trigger reposition)
this.themeAdapter.onThemeChange(this.layoutChangeHandler);
}
@@ -319,6 +341,13 @@
if (this.resizeHandler) {
window.removeEventListener('resize', this.resizeHandler);
}
if (this.scrollHandler) {
window.removeEventListener('scroll', this.scrollHandler);
if (this.scrollRafId) {
cancelAnimationFrame(this.scrollRafId);
this.scrollRafId = null;
}
}
}
/**
@@ -353,6 +382,7 @@
onTourComplete() {
this.progressTracker.markTourCompleted();
this.isActive = false;
this.cleanupDynamicRepositioning();
debug('[TourManager] Tour completed');
}