Skip to content

Commit

Permalink
[v3] remove aria-hidden attr when scroll-to-top button is visible (#3251
Browse files Browse the repository at this point in the history
)

* [v3] remove aria-hidden attr when scroll-to-top button is visible

* Update packages/nextra-theme-docs/src/components/back-to-top.tsx

---------

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
  • Loading branch information
87xie and dimaMachina authored Sep 16, 2024
1 parent cee94a6 commit bf963cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/few-snails-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nextra-theme-docs': patch
---

Remove the aria-hidden attribute from scroll-to-top button when it is visible
3 changes: 2 additions & 1 deletion packages/nextra-theme-docs/src/components/back-to-top.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export function BackToTop({
}): ReactElement {
return (
<Button
aria-hidden="true"
// elements with `aria-hidden: true` must not be focusable or contain focusable elements
aria-hidden={hidden ? 'true' : undefined}
onClick={scrollToTop}
disabled={hidden}
className={({ disabled }) =>
Expand Down

0 comments on commit bf963cd

Please sign in to comment.