diff --git a/site/theme/template/Content/MainContent.jsx b/site/theme/template/Content/MainContent.jsx index f54d4ce64..77b738bd7 100644 --- a/site/theme/template/Content/MainContent.jsx +++ b/site/theme/template/Content/MainContent.jsx @@ -17,10 +17,16 @@ export default class MainContent extends React.Component { document.body.scrollTop = 0; document.documentElement.scrollTop = 0; } else { - location.hash = location.hash; + this.timer = setTimeout(() => { + document.getElementById(location.hash.replace('#', '')).scrollIntoView(); + }, 10); } } + componentWillUnmount() { + clearTimeout(this.timer); + } + shouldComponentUpdate(nextProps) { const pathname = this.props.location.pathname; return pathname !== nextProps.location.pathname ||