Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
fix(docsearch): use scrollTo when unmounting modal
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Jun 8, 2020
1 parent 6a694ed commit aae0a14
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/docsearch-react/src/DocSearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ export function DocSearchModal({

return () => {
document.body.classList.remove('DocSearch--active');
document.body.scrollTop = scrollY.current;
// IE11 doesn't support `scrollTo` so we check that the method exists
// first.
window.scrollTo?.(0, scrollY.current);
};
}, []);

Expand Down

0 comments on commit aae0a14

Please sign in to comment.