1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

A11y: Set focus back to body after link was clicked (#3545)

This commit is contained in:
Connor Bär 2018-01-25 15:44:57 +01:00 committed by Tim Neutkens
parent e451218900
commit 8dd8e200e0

View file

@ -75,7 +75,10 @@ export default class Link extends Component {
Router[changeMethod](href, as, { shallow })
.then((success) => {
if (!success) return
if (scroll) window.scrollTo(0, 0)
if (scroll) {
window.scrollTo(0, 0)
document.body.focus()
}
})
.catch((err) => {
if (this.props.onError) this.props.onError(err)