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

This commit is contained in:
Joffrey JAFFEUX 2023-06-06 16:28:06 +02:00 committed by GitHub
parent 9661a8c214
commit ad0a8cccc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,9 +120,11 @@ export default class LockOn {
return this.clearLock(); 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); window.scrollTo(window.pageXOffset, top);
this.previousTop = top; this.previousTop = top;
} else {
return this.clearLock();
} }
// Stop early when maintaining the original offset // Stop early when maintaining the original offset