Skip to content

Commit

Permalink
Update router.md to improve a11y (#23611)
Browse files Browse the repository at this point in the history
Code examples used `span`, change to use `button` for better accessibility 

## Documentation / Examples

- [x] Make sure the linting passes
  • Loading branch information
samrobbins85 committed Apr 1, 2021
1 parent bfd36bd commit 4de984c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/api-reference/next/router.md
Expand Up @@ -99,7 +99,7 @@ import { useRouter } from 'next/router'
export default function Page() {
const router = useRouter()

return <span onClick={() => router.push('/post/abc')}>Click me</span>
return <button onClick={() => router.push('/post/abc')}>Click me</button>
}
```

Expand Down Expand Up @@ -137,7 +137,7 @@ export default function ReadMore({ post }) {
const router = useRouter()

return (
<span
<button
onClick={() => {
router.push({
pathname: '/post/[pid]',
Expand All @@ -146,7 +146,7 @@ export default function ReadMore({ post }) {
}}
>
Click here to read more
</span>
</button>
)
}
```
Expand All @@ -171,7 +171,7 @@ import { useRouter } from 'next/router'
export default function Page() {
const router = useRouter()

return <span onClick={() => router.replace('/home')}>Click me</span>
return <button onClick={() => router.replace('/home')}>Click me</button>
}
```

Expand Down Expand Up @@ -282,7 +282,7 @@ import { useRouter } from 'next/router'
export default function Page() {
const router = useRouter()

return <span onClick={() => router.back()}>Click here to go back</span>
return <button onClick={() => router.back()}>Click here to go back</button>
}
```

Expand All @@ -298,7 +298,7 @@ import { useRouter } from 'next/router'
export default function Page() {
const router = useRouter()

return <span onClick={() => router.reload()}>Click here to reload</span>
return <button onClick={() => router.reload()}>Click here to reload</button>
}
```

Expand Down

0 comments on commit 4de984c

Please sign in to comment.