From 41e2fb2f9316382e6d09135f43af5838d33ead56 Mon Sep 17 00:00:00 2001 From: GabrielMeyer Date: Tue, 7 May 2019 14:22:39 +0200 Subject: [PATCH] Fixes scrollbar in old firefox versions --- client/src/app/site/site.component.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/client/src/app/site/site.component.ts b/client/src/app/site/site.component.ts index 073b55608..002074684 100644 --- a/client/src/app/site/site.component.ts +++ b/client/src/app/site/site.component.ts @@ -99,6 +99,23 @@ export class SiteComponent extends BaseComponent implements OnInit { // console.log('translation of motions in the target language: ' + res); // }); + // TODO: Remove this, when the ESR version of Firefox >= 64. + const agent = navigator.userAgent.toLowerCase(); + if (agent.indexOf('firefox') > -1) { + const index = agent.indexOf('firefox') + 8; + const version = +agent.slice(index, index + 2); + + if (version < 64) { + const sideNav = document.querySelector( + 'mat-sidenav.side-panel > div.mat-drawer-inner-container' + ) as HTMLElement; + sideNav.style.overflow = 'hidden'; + sideNav.addEventListener('MozMousePixelScroll', (event: any) => { + sideNav.scrollBy(0, event.detail); + }); + } + } + this.router.events.subscribe(event => { // Scroll to top if accessing a page, not via browser history stack if (event instanceof NavigationEnd) {