diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index 75d932f14..c650277a6 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -4203,6 +4203,14 @@ EndColorStr='#ececec');
z-index: 52;
}
+/* offset the tags in reference to account for sticky nav */
+body.reference a[name] {
+ visibility: hidden;
+ display: block;
+ position: relative;
+ top: -56px;
+}
+
}
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index f03fb888f..5e548c853 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -2535,16 +2535,13 @@ google.setOnLoadCallback(function(){
}
}, true);
-/* Adjust the scroll position to account for sticky header, only if the hash matches an id */
+/* Adjust the scroll position to account for sticky header, only if the hash matches an id.
+ This does not handle tags. Some CSS fixes those, but only for reference docs. */
function offsetScrollForSticky() {
var hash = escape(location.hash.substr(1));
var $matchingElement = $("#"+hash);
- // If there's no element with the hash as an ID, then look for an with it.
- if ($matchingElement.length < 1) {
- $matchingElement = $('a[name="' + hash + '"]');
- }
- // Sanity check that there's an element with that ID on the page
- if ($matchingElement.length) {
+ // Sanity check that hash is a real hash and that there's an element with that ID on the page
+ if ((hash.indexOf("#") == 0) && $matchingElement.length) {
// If the position of the target element is near the top of the page (<20px, where we expect it
// to be because we need to move it down 60px to become in view), then move it down 60px
if (Math.abs($matchingElement.offset().top - $(window).scrollTop()) < 20) {
diff --git a/tools/droiddoc/templates-sdk/class.cs b/tools/droiddoc/templates-sdk/class.cs
index 8ffe2f94d..7aa99f968 100644
--- a/tools/droiddoc/templates-sdk/class.cs
+++ b/tools/droiddoc/templates-sdk/class.cs
@@ -5,6 +5,8 @@
diff --git a/tools/droiddoc/templates-sdk/classes.cs b/tools/droiddoc/templates-sdk/classes.cs
index 4eab4381e..405892d67 100644
--- a/tools/droiddoc/templates-sdk/classes.cs
+++ b/tools/droiddoc/templates-sdk/classes.cs
@@ -5,6 +5,8 @@
diff --git a/tools/droiddoc/templates-sdk/package.cs b/tools/droiddoc/templates-sdk/package.cs
index acb4ee92c..22255650b 100644
--- a/tools/droiddoc/templates-sdk/package.cs
+++ b/tools/droiddoc/templates-sdk/package.cs
@@ -6,6 +6,8 @@
diff --git a/tools/droiddoc/templates-sdk/packages.cs b/tools/droiddoc/templates-sdk/packages.cs
index 44680c30a..5056d3a5d 100644
--- a/tools/droiddoc/templates-sdk/packages.cs
+++ b/tools/droiddoc/templates-sdk/packages.cs
@@ -4,6 +4,8 @@