Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip to content functionality #1048

Closed
joelit opened this issue Sep 1, 2020 · 3 comments · Fixed by #1050
Closed

Skip to content functionality #1048

joelit opened this issue Sep 1, 2020 · 3 comments · Fixed by #1050
Assignees
Labels
Milestone

Comments

@joelit
Copy link
Contributor

joelit commented Sep 1, 2020

When browsing the Skosmos pages with either vocabulary list, vocabulary info, search results or concept info, the browser focus should go first to the skip to content -link in:

<div id="skiptocontent">

This does not happen in practise, as the focus is moved to the search field first. The culprit seems to be docready.js, which alters the focus in various ways, e.g.

if ($('.search-result-listing').length === 0) { $("#search-field").focus(); }

This issue was split from #1036 #1037 #1038 & #1039

@joelit joelit added the WCAG label Sep 1, 2020
@joelit joelit self-assigned this Sep 1, 2020
@osma
Copy link
Member

osma commented Sep 1, 2020

Related discussion on SO: https://stackoverflow.com/questions/2180645/is-automatically-assigning-focus-bad-for-accessibility

@osma
Copy link
Member

osma commented Sep 1, 2020

The more modern way to implement autofocus would be to use the autofocus attribute in HTML5 instead of JavaScript. But regardless of the autofocus implementation, it causes accessibility concerns.

My current understanding is that autofocus should be used very sparingly - only on pages whose primary purpose is text input (e.g. Google homepage style search, login forms, contact forms).

I propose dropping the autofocus JS code from the docready.js script in Skosmos and, if necessary, using the autofocus attribute on pages that really deserve it - I think only the contact form qualifies.

Some more background reading:

@joelit
Copy link
Contributor Author

joelit commented Sep 1, 2020

Thanks, I'll give it a read-through!

I was thinking of handling the focus order through HTML, as I don't see a reason why the tabindex wouldn't be enough for the search field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants