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:
Waheed Ahmed
2021-04-07 15:28:26 +05:00
committed by GitHub
parent 6a04c744a8
commit 96d1be44c2
6 changed files with 19 additions and 6 deletions

View File

@@ -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);
};

View File

@@ -5,5 +5,6 @@ export {
updatePathWithQueryParams,
getAllPossibleQueryParam,
getActivationStatus,
windowScrollTo,
} from './dataUtils';
export { default as AsyncActionType } from './reduxUtils';