git ssb

10+

Matt McKegg / patchwork



Commit 14f1ed9474297056ede54cf5ac32ab68c782d79d

attempting to fix anchor body jump bug (again)

Matt McKegg committed on 10/12/2017, 2:28:15 AM
Parent: 08a7cff8db13bc65b509e3ba4f53566e2cb21e6a

Files changed

lib/anchor-hook.jschanged
modules/page/html/render/message.jschanged
lib/anchor-hook.jsView
@@ -7,8 +7,15 @@
77 return watch(current, (current) => {
88 if (current === name) {
99 window.requestAnimationFrame(() => {
1010 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+
1118 if (typeof cb === 'function') cb(element)
1219 })
1320 }
1421 })
modules/page/html/render/message.jsView
@@ -117,13 +117,8 @@
117117 if (scrollParent) {
118118 // ensure context is visible
119119 scrollParent.scrollTop = Math.max(0, scrollParent.scrollTop - 100)
120120 }
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- }
126121 }
127122
128123 function getScrollParent (element) {
129124 while (element.parentNode) {

Built with git-ssb-web