Permalink
Browse files

attempting to fix anchor body jump bug (again)

  • Loading branch information...
mmckegg committed Oct 12, 2017
1 parent 08a7cff commit 14f1ed9474297056ede54cf5ac32ab68c782d79d
Showing with 7 additions and 5 deletions.
  1. +7 −0 lib/anchor-hook.js
  2. +0 −5 modules/page/html/render/message.js
View
@@ -8,6 +8,13 @@ function AnchorHook (name, current, cb) {
if (current === name) {
window.requestAnimationFrame(() => {
element.scrollIntoView()
// HACK: due to a browser bug, sometimes the body gets affected!?
// Why not just hack it!!!
if (document.body.scrollTop > 0) {
document.body.scrollTop = 0
}
if (typeof cb === 'function') cb(element)
})
}
@@ -118,11 +118,6 @@ function showContext (element) {
// ensure context is visible
scrollParent.scrollTop = Math.max(0, scrollParent.scrollTop - 100)
}
// HACK: sometimes the body gets affected!? Why no just hack it!!!
if (document.body.scrollTop > 0) {
document.body.scrollTop = 0
}
}
function getScrollParent (element) {

0 comments on commit 14f1ed9

Please sign in to comment.