Skip to content

A platform for community discussion. Free, open, simple.

FIX: attempts to exit lock-on early (#21949)

Joffrey JAFFEUXad0a8cccc8c4
diff --git a/app/assets/javascripts/discourse/app/lib/lock-on.js b/app/assets/javascripts/discourse/app/lib/lock-on.js
index 4f18588f3d6..1629f9c5606 100644
--- a/app/assets/javascripts/discourse/app/lib/lock-on.js
+++ b/app/assets/javascripts/discourse/app/lib/lock-on.js
@@ -120,9 +120,11 @@ export default class LockOn {
return this.clearLock();
}
- if (!within(4, top, this.previousTop) || !within(4, window.scrollY, top)) {
+ if (!within(4, top, this.previousTop)) {
window.scrollTo(window.pageXOffset, top);
this.previousTop = top;
+ } else {
+ return this.clearLock();
}
// Stop early when maintaining the original offset