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:
parent
e451218900
commit
8dd8e200e0
|
@ -75,7 +75,10 @@ export default class Link extends Component {
|
||||||
Router[changeMethod](href, as, { shallow })
|
Router[changeMethod](href, as, { shallow })
|
||||||
.then((success) => {
|
.then((success) => {
|
||||||
if (!success) return
|
if (!success) return
|
||||||
if (scroll) window.scrollTo(0, 0)
|
if (scroll) {
|
||||||
|
window.scrollTo(0, 0)
|
||||||
|
document.body.focus()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (this.props.onError) this.props.onError(err)
|
if (this.props.onError) this.props.onError(err)
|
||||||
|
|
Loading…
Reference in a new issue