foundation / foundation-sites

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.
https://get.foundation
MIT License
29.64k stars 5.5k forks source link

Magellan does not account for barOffset when setting active menu item #8725

Closed flyingL123 closed 6 years ago

flyingL123 commented 8 years ago

If Magellan is applied using the barOffset option, the _updateActive() method does not account for this value when setting the active menu item. This is particularly noticeable when using a sticky menu because if you click on a menu item, you are scrolled to the appropriate section, but the menu item before the selected one will get the active class instead of the menu item for the section you just scrolled to. This results in an odd user experience.

I believe it's a one-line fix, and it's working for me, so unless there are some other consequences, it should be an easy update.

Line 136 needs to be changed from:

return isDown ? p <= winPos : p - _this.options.threshold <= winPos;

to:

return isDown ? p - _this.options.barOffset <= winPos : p - _this.options.barOffset - _this.options.threshold <= winPos;
JeremyEnglert commented 6 years ago

Looks like a PR was merged to fix this. Thanks @flyingL123!