fix(wcc-dashboard): Improve scroll listener management and add new test pages

This commit is contained in:
Juergen Kunz
2025-06-26 23:11:58 +00:00
parent b6c41caf44
commit c1d8e347de
8 changed files with 161 additions and 8 deletions

View File

@ -38,12 +38,8 @@ export class WccDashboard extends DeesElement {
@property()
public warning: string = null;
@property()
public frameScrollY: number = 0;
@property()
public sidebarScrollY: number = 0;
private frameScrollY: number = 0;
private sidebarScrollY: number = 0;
private scrollPositionsApplied: boolean = false;
@queryAsync('wcc-frame')
@ -222,8 +218,14 @@ export class WccDashboard extends DeesElement {
}
private scrollUpdateTimeout: NodeJS.Timeout;
private scrollListenersAttached: boolean = false;
public async setupScrollListeners() {
// Prevent duplicate listeners
if (this.scrollListenersAttached) {
return;
}
const wccFrame = await this.wccFrame;
const wccSidebar = this.shadowRoot.querySelector('wcc-sidebar');
@ -233,6 +235,7 @@ export class WccDashboard extends DeesElement {
this.frameScrollY = wccFrame.scrollTop;
this.debouncedScrollUpdate();
});
this.scrollListenersAttached = true;
}
if (wccSidebar) {