Fix scroll error for older browsers. (#235)
Check if scrollBehavior is supported otherwise fallback to two arguments window.scrollTo(x-coord, y-coord). VAN-439
This commit is contained in:
@@ -68,3 +68,13 @@ export const getActivationStatus = () => {
|
||||
|
||||
return params.account_activation_status;
|
||||
};
|
||||
|
||||
export const isScrollBehaviorSupported = () => 'scrollBehavior' in document.documentElement.style;
|
||||
|
||||
export const windowScrollTo = (options) => {
|
||||
if (isScrollBehaviorSupported()) {
|
||||
return window.scrollTo(options);
|
||||
}
|
||||
|
||||
return window.scrollTo(options.top, options.left);
|
||||
};
|
||||
|
||||
@@ -5,5 +5,6 @@ export {
|
||||
updatePathWithQueryParams,
|
||||
getAllPossibleQueryParam,
|
||||
getActivationStatus,
|
||||
windowScrollTo,
|
||||
} from './dataUtils';
|
||||
export { default as AsyncActionType } from './reduxUtils';
|
||||
|
||||
Reference in New Issue
Block a user