From f8d6f949fe141189b36359d2e09bcc58a01d62ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Denton?= <=remy.denton@pega.com> Date: Tue, 26 Jun 2018 09:04:07 -0700 Subject: [PATCH] fix: Add extra offset to gumshoe to fix perceived bug (WWWD-2278) --- packages/components/bolt-nav-indicator/nav-indicator.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/components/bolt-nav-indicator/nav-indicator.js b/packages/components/bolt-nav-indicator/nav-indicator.js index bb1d58adfc..e3abab88cc 100644 --- a/packages/components/bolt-nav-indicator/nav-indicator.js +++ b/packages/components/bolt-nav-indicator/nav-indicator.js @@ -59,6 +59,10 @@ let gumshoeStateModule = (function () { let pub = {}; // public object - returned at end of module to allow external interaction let reference; + // If gumshoe doesn't activate until an anchor link is all the way at the top, if feels late. + // This offset makes attempts to correct for that perceived bug by activating links a little bit earlier during scroll. + const gumshoeExtraOffset = 100; + // navSelectorInstance is used to map up the element calling setOffset so methods can get used pub.setOffset = function (newOffset, navSelectorInstance) { if (offset !== newOffset) { @@ -70,7 +74,7 @@ let gumshoeStateModule = (function () { // without a value for activeClass, so we give it a placeholder. activeClass: 'has-gumshoe-focus', scrollDelay: false, - offset, + offset: parseInt(offset) + gumshoeExtraOffset, callback(nav) { /** * Exit early if nav OR nav.nav (the target) is undefined. Workaround to occasional JS error throwing: