From: Alexander Ebert Date: Fri, 7 Aug 2020 14:52:41 +0000 (+0200) Subject: Ignore certain scroll events that are just side effects X-Git-Tag: 5.3.0_Alpha_1~68^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8797b34199979c1f1bebf5a63bf3b5737deeeedd;p=GitHub%2FWoltLab%2FWCF.git Ignore certain scroll events that are just side effects --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js index 429a28f212..db018aaa6c 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js @@ -72,7 +72,18 @@ define(['Dictionary', 'Language'], function (Dictionary, Language) { * @param {Event=} event */ _onScroll: function (event) { + if (document.documentElement.classList.contains('disableScrolling')) { + // Ignore any scroll events that take place while body scrolling is disabled, + // because it messes up the scroll offsets. + return; + } + var offset = window.pageYOffset; + if (offset === _lastPosition) { + // Ignore any scroll event that is fired but without a position change. This can + // happen after closing a dialog that prevented the body from being scrolled. + return; + } if (offset >= 300) { if (_toTopButton.classList.contains('initiallyHidden')) {