Commit 14f1ed9474297056ede54cf5ac32ab68c782d79d
attempting to fix anchor body jump bug (again)
Matt McKegg committed on 10/12/2017, 2:28:15 AMParent: 08a7cff8db13bc65b509e3ba4f53566e2cb21e6a
Files changed
lib/anchor-hook.js | changed |
modules/page/html/render/message.js | changed |
lib/anchor-hook.js | ||
---|---|---|
@@ -7,8 +7,15 @@ | ||
7 | 7 | return watch(current, (current) => { |
8 | 8 | if (current === name) { |
9 | 9 | window.requestAnimationFrame(() => { |
10 | 10 | element.scrollIntoView() |
11 | + | |
12 | + // HACK: due to a browser bug, sometimes the body gets affected!? | |
13 | + // Why not just hack it!!! | |
14 | + if (document.body.scrollTop > 0) { | |
15 | + document.body.scrollTop = 0 | |
16 | + } | |
17 | + | |
11 | 18 | if (typeof cb === 'function') cb(element) |
12 | 19 | }) |
13 | 20 | } |
14 | 21 | }) |
modules/page/html/render/message.js | ||
---|---|---|
@@ -117,13 +117,8 @@ | ||
117 | 117 | if (scrollParent) { |
118 | 118 | // ensure context is visible |
119 | 119 | scrollParent.scrollTop = Math.max(0, scrollParent.scrollTop - 100) |
120 | 120 | } |
121 | - | |
122 | - // HACK: sometimes the body gets affected!? Why no just hack it!!! | |
123 | - if (document.body.scrollTop > 0) { | |
124 | - document.body.scrollTop = 0 | |
125 | - } | |
126 | 121 | } |
127 | 122 | |
128 | 123 | function getScrollParent (element) { |
129 | 124 | while (element.parentNode) { |
Built with git-ssb-web