From b858b3b9e23bff6bccef31a3b5a6b2ea8a72a783 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Thu, 26 Jun 2025 22:52:54 +0000 Subject: [PATCH] fix(wcc-dashboard): Prevent duplicate application of scroll positions in dashboard to avoid interfering with user scrolling --- changelog.md | 6 ++++++ ts_web/00_commitinfo_data.ts | 2 +- ts_web/elements/wcc-dashboard.ts | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 5386c20..28ccc8b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-06-26 - 1.0.100 - fix(wcc-dashboard) +Prevent duplicate application of scroll positions in dashboard to avoid interfering with user scrolling + +- Added a private 'scrollPositionsApplied' property to track if scroll positions have already been applied +- Introduced a guard in the applyScrollPositions method to ensure the scroll state is applied only once + ## 2025-06-26 - 1.0.99 - fix(dashboard) Fix scroll state preservation in dashboard by tracking frame and sidebar scroll positions and updating the URL accordingly. diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index e7ca23b..94d0b56 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@design.estate/dees-wcctools', - version: '1.0.99', + version: '1.0.100', description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.' } diff --git a/ts_web/elements/wcc-dashboard.ts b/ts_web/elements/wcc-dashboard.ts index f7669c8..8c32a60 100644 --- a/ts_web/elements/wcc-dashboard.ts +++ b/ts_web/elements/wcc-dashboard.ts @@ -44,6 +44,8 @@ export class WccDashboard extends DeesElement { @property() public sidebarScrollY: number = 0; + private scrollPositionsApplied: boolean = false; + @queryAsync('wcc-frame') public wccFrame: Promise; @@ -268,6 +270,11 @@ export class WccDashboard extends DeesElement { } public async applyScrollPositions() { + // Only apply scroll positions once to avoid interfering with user scrolling + if (this.scrollPositionsApplied) { + return; + } + const wccFrame = await this.wccFrame; const wccSidebar = this.shadowRoot.querySelector('wcc-sidebar'); @@ -280,5 +287,7 @@ export class WccDashboard extends DeesElement { // The sidebar element itself is the scrollable container wccSidebar.scrollTop = this.sidebarScrollY; } + + this.scrollPositionsApplied = true; } }