Skip to content

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 ad3dc51 commit 1f9deb1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 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 1f9deb1

Please sign in to comment.