diff --git a/tf_oss_dashboard/script.js b/tf_oss_dashboard/script.js index 4182d60b63a70429b7c1ae4f913f16258a8a52c5..346a75679e07577aa118bfccf25d2816a76e17c8 100644 --- a/tf_oss_dashboard/script.js +++ b/tf_oss_dashboard/script.js @@ -97,15 +97,19 @@ $(function () { history.replaceState(null, null, ' ') }) - // When the page loads, if there is a commit ID in the location hash, show - // the matching modal -- that is, if you load dashboard#commit, show the modal - // for that commit. Also, show the matching modal if a CL is provided instead. + // When the page loads, check the location hash, and... + // - If there's a matching category on the page, scroll to it + // - If there is a commit ID in the location hash, show that commit + // - If there is a CL in the location hash, show that CL's commit + // - If there is a PR in the location hash, show that PR's commit unescaped = decodeURIComponent(window.location.hash).replace("#", "").replace("+", "") - // Nothing to do if no hash in the URL if (window.location.hash.length <= 1) { - // Empty! - // If the hash matches a Category on the page, then scroll to it + // Nothing to do if no hash in the URL + // If the hash matches a Category on the page, then scroll to it. } else if (document.getElementById(unescaped)) { + // Google Chrome, at least, does not scroll if the tab is opened in the + // background, so we try and scroll a moment after the first time the tab + // gets focus, or immediately if it has focus already. if (document.hasFocus()) { document.getElementById(unescaped).scrollIntoView(); } else { diff --git a/tf_oss_dashboard/template.html.pug b/tf_oss_dashboard/template.html.pug index 8e97c86dce94708bfeddaa03686d819a27576459..d96097da9a8cf814a297a3c705d064ad243b653a 100644 --- a/tf_oss_dashboard/template.html.pug +++ b/tf_oss_dashboard/template.html.pug @@ -21,7 +21,7 @@ html(lang="en") nav.navbar.navbar-dark.navbar-expand-lg.py-0.mb-2 .container-fluid.py-0 .d-flex.flex-row - a.navbar-brand TensorFlow GitHub CI + a(href=).navbar-brand TensorFlow GitHub CI .navbar-text#tf-now(data-isonow=isonow) Last updated on a(title="Check the dashboard deployment GitHub Actions workflow" href="https://github.com/tensorflow/build/actions/workflows/dashboard.yml") #{now} |