Open martocode opened 3 years ago
scrollTo = () => { let currentWin = this.props.location.hash; const hasAnchor = currentWin.includes("#"); if (hasAnchor) { const goTo = document.querySelector(currentWin); console.log(goTo, "www"); if (goTo) { goTo.scrollIntoView({ behavior: "smooth" }); // Doesn't work with instant } } // this.awards.current.scrollIntoView({ behavior: "auto" }); };
Fixed by adding setTimeout to 500 ms
if (goTo) { setTimeout(() => { goTo.scrollIntoView({ behavior: "instant" }); // Doesn't work with instant }, 500) }