diff --git a/webroot/rsrc/js/application/core/behavior-active-nav.js b/webroot/rsrc/js/application/core/behavior-active-nav.js index 43fcc3328f..a753e15184 100644 --- a/webroot/rsrc/js/application/core/behavior-active-nav.js +++ b/webroot/rsrc/js/application/core/behavior-active-nav.js @@ -28,8 +28,11 @@ JX.behavior('phabricator-active-nav', function(config) { link, 'phabricator-active-nav-focus', selected); + if (selected && link.scrollIntoView) { + link.scrollIntoView(false); + } } - } + }; /** @@ -72,15 +75,24 @@ JX.behavior('phabricator-active-nav', function(config) { // If we get above the first marker, select it. selectnav(active && JX.Stratcom.getData(active).anchor); - } + }; var pending = null; var onviewportchange = function(e) { pending && clearTimeout(pending); pending = setTimeout(updateposition, 100); - } + }; - JX.Stratcom.listen('scroll', null, onviewportchange); + var onscroll = function(e) { + if (e.getNode('tag:body')) { + // If we are inside then it means we just scrolled some