From 8797b34199979c1f1bebf5a63bf3b5737deeeedd Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 7 Aug 2020 16:52:41 +0200 Subject: [PATCH] Ignore certain scroll events that are just side effects --- .../files/js/WoltLabSuite/Core/Ui/Page/Action.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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')) { -- 2.20.1