The value of scrollOptions is not compared to null so the element.scrollIntoView will be executed into the first "if condition".
B. Solutions to fix it...
1. Considering scrollOptions as a global configuration AND a section configuration
If we compare scrollOptions into the "if" condition and the "else if" condition then the "else" will be executed.
But there is no preventScroll into the "else" section so the page will scroll to the focus element contrary to the documentation.
I'm afraid that the preventScroll into the "else" may change the behavior of existing app.
2. Considering scrollOptions exclusively as a global configuration
Still according to the vue-js-spatial-navigation, scrollOptions is classified as an Optional global Configuration.
Into index.js, assignConfig function, l. 15 :
const assignConfig = (sectionId, config) => {
let sectionConfig = Object.assign({}, globalConfig);
if (config) {
Object.assign(sectionConfig, config);
}
...
};
Each section received the global config scrollOptions if not declared in the config of the section, which is a little bit weird for a global configuration.
So if scrollOptions has to be considered exclusively as a global configuration, it changes the correction of focusNScroll. All we need is to check the global configuration :
However, it's interesting to have the possibility to set the scrollOptions for each section, in my opinion the first correction is the best and we can classified the scrollOptions both as a global configuration AND a section configuration into the README.md file.
ISSUE : scrollOptions configuration is not working as expected
A. The issue
According to the documentation of vue-js-spatial-navigation about
scrollOptions
:However, in _spatialnavigation.js, focusNScroll function, l. 605 :
The value of
scrollOptions
is not compared tonull
so the element.scrollIntoView will be executed into the first "if condition".B. Solutions to fix it...
1. Considering scrollOptions as a global configuration AND a section configuration
If we compare
scrollOptions
into the "if" condition and the "else if" condition then the "else" will be executed. But there is nopreventScroll
into the "else" section so the page will scroll to the focus element contrary to the documentation.So the best correction is :
I'm afraid that the
preventScroll
into the "else" may change the behavior of existing app.2. Considering scrollOptions exclusively as a global configuration
Still according to the vue-js-spatial-navigation,
scrollOptions
is classified as an Optional global Configuration.Into index.js, assignConfig function, l. 15 :
Each section received the global config
scrollOptions
if not declared in the config of the section, which is a little bit weird for a global configuration. So ifscrollOptions
has to be considered exclusively as a global configuration, it changes the correction offocusNScroll
. All we need is to check the global configuration :However, it's interesting to have the possibility to set the
scrollOptions
for each section, in my opinion the first correction is the best and we can classified thescrollOptions
both as a global configuration AND a section configuration into the README.md file.Thanks for paying attention, Have a pleasant day.