alphagov / tech-docs-gem

Gem to distribute the tech docs project
https://tdt-documentation.london.cloudapps.digital/
MIT License
15 stars 38 forks source link

Don't change the focus of the page on initial load #244

Closed colinbm closed 3 years ago

colinbm commented 3 years ago

⚠️ Don't forget to update the gem version in the CHANGELOG before merging! When you're ready to release bump version file and generate a tag. ⚠️

What

On loading a page initially foo.html do not change the URL to foo.html#h1-id until scrolling past. Remove the fragment from the navigation for the h1.

Why

It is expected that focus will begin at the start of the page. Changing this is confusing for screen reader users.

On page load the main page heading is automatically focused. This may be navigationally disorientating for users reliant on the use of the keyboard alone to navigate.

Keyboard only user comments: “When this page loads, focus starts in the content of the page. I found this confusing as I expected my focus to start at the top of the page.”

Solution: Users would expect to navigate the page in reading order, from top to bottom and left to right.

Note

~I'm not sure about the navigation change... in itself it's not confusing as the target fragment is clear in the clicked link, but it still seems like the link to the "page" rather than "position on page" should be at the beginning. I'm going to double check this with DAC, but welcome any thoughts.~ Confirmed this is correct approach with DAC.