Commit 4726c435 authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by Tim Neutkens

Scroll to the hash only if there's one after an error. (#2224)

parent ad4ec554
...@@ -44,12 +44,14 @@ class Container extends Component { ...@@ -44,12 +44,14 @@ class Container extends Component {
scrollToHash () { scrollToHash () {
const { hash } = this.props const { hash } = this.props
if (!hash) return
const el = document.getElementById(hash) const el = document.getElementById(hash)
if (el) { if (!el) return
// If we call scrollIntoView() in here without a setTimeout
// it won't scroll properly. // If we call scrollIntoView() in here without a setTimeout
setTimeout(() => el.scrollIntoView(), 0) // it won't scroll properly.
} setTimeout(() => el.scrollIntoView(), 0)
} }
shouldComponentUpdate (nextProps) { shouldComponentUpdate (nextProps) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment