a11y: remove ScrollToTop from tab order and hide from screen readers when not visible
- Added tabIndex={-1} when button is hidden to remove from keyboard tab order
- Added aria-hidden when not visible to hide from screen readers
- Added title attribute for tooltip text
Closes #6
This commit is contained in:
@@ -29,7 +29,10 @@ export function ScrollToTop() {
|
|||||||
className={`scroll-to-top ${visible ? 'scroll-to-top--visible' : ''}`}
|
className={`scroll-to-top ${visible ? 'scroll-to-top--visible' : ''}`}
|
||||||
onClick={scrollToTop}
|
onClick={scrollToTop}
|
||||||
aria-label="Scroll to top"
|
aria-label="Scroll to top"
|
||||||
|
title="Scroll to top"
|
||||||
type="button"
|
type="button"
|
||||||
|
tabIndex={visible ? 0 : -1}
|
||||||
|
aria-hidden={!visible}
|
||||||
>
|
>
|
||||||
↑
|
↑
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user