mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 09:48:21 +01:00
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
This commit is contained in:
parent
edb427d6c3
commit
ea160c2ccb
@ -61,6 +61,19 @@ namespace OS {
|
|||||||
* @memberof DesktopTag
|
* @memberof DesktopTag
|
||||||
*/
|
*/
|
||||||
protected mount(): void {
|
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)
|
if(this.observer)
|
||||||
{
|
{
|
||||||
this.observer.disconnect();
|
this.observer.disconnect();
|
||||||
|
Loading…
Reference in New Issue
Block a user