From ea160c2ccbfdf7a4ce782f26d1c00c9e562cfff3 Mon Sep 17 00:00:00 2001 From: DanyLE Date: Fri, 6 Jan 2023 21:34:46 +0100 Subject: [PATCH] fix: prevent scroll on desktop When focusing on a window which overflows the desktop, the desktop scrolls automatically to bottom, even when `overflow: hiddle` is set on CSS. This tricky hack prevents this to happen --- src/core/tags/DesktopTag.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/tags/DesktopTag.ts b/src/core/tags/DesktopTag.ts index 27f0257..cfd21db 100644 --- a/src/core/tags/DesktopTag.ts +++ b/src/core/tags/DesktopTag.ts @@ -61,6 +61,19 @@ namespace OS { * @memberof DesktopTag */ protected mount(): void { + /** + * TRICKY HACK + * When focusing on a window which overflows the desktop, + * the desktop scrolls automatically to bottom, + * even when `overflow: hiddle` is set on CSS. + * + * The following event listener prevents + * the desktop to scroll down in this case + */ + $(this).on("scroll", (e) =>{ + if(this.scrollTop != 0) + this.scrollTop = 0; + }); if(this.observer) { this.observer.disconnect();