Skip to content

Commit

Permalink
fix: Add extra offset to gumshoe to fix perceived bug (WWWD-2278)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy Denton committed Jun 26, 2018
1 parent 32f425e commit f8d6f94
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/components/bolt-nav-indicator/nav-indicator.js
Expand Up @@ -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 <bolt-nav-indicator> methods can get used
pub.setOffset = function (newOffset, navSelectorInstance) {
if (offset !== newOffset) {
Expand All @@ -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:
Expand Down

0 comments on commit f8d6f94

Please sign in to comment.