openfed / kiso

Openfed D8 base theme
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Improve back to top while using tab navigation #47

Open laurent-b4y opened 3 years ago

laurent-b4y commented 3 years ago

When using tab navigation the back to top button doesn't focus on the first element of the page.

I'm using this to fix.

`// Back to top focus on tab navigation fix. var backToTop = document.querySelector('.back-to-top'); var skipLink = document.querySelector('.skip-link');

backToTop.addEventListener('click', function () { skipLink.focus(); });`

smillart commented 3 years ago

Do you really think we need to get the "Skip to main content" link focused when using the "Back to top" link (keyboard event)? I think we just make sure, once the top of the page is reached, the "Skip to main content" link is the first item that screen readers hear and that keyboard users access when the Tab key pressed. I think the current behavior is what expected.

However, I noticed it is a bit buggy and we need to move the "Back to top" link to the very bottom of the page (end of the footer section).

laurent-b4y commented 3 years ago

That would be even better, as it's now after tabbing and using the back to top the next tab jumps to the footer menu.