Be more strategic about autofocus usage in the OPAC

Bug #1796225 reported by Jane Sandberg on 2018-10-05
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Medium
Unassigned

Bug Description

Currently, the following pages autofocus on the search box, even though searching is not the purpose of the page:
* https://demo.evergreencatalog.com/eg/opac/results?query=cat
* https://demo.evergreencatalog.com/eg/opac/record/8405?query=cat
* https://demo.evergreencatalog.com/eg/opac/library/SL1
* https://demo.evergreencatalog.com/eg/opac/mylist
* https://demo.evergreencatalog.com/eg/opac/password_reset

This is problematic from an accessibility perspective, see the following:
* https://www.brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/
* https://stackoverflow.com/a/2180699/5636330

I think this could be easily fixed by changing this line to check that is_home_page is true as well as basic_search != "f" before adding that autofocus element: https://github.com/evergreen-library-system/Evergreen/blob/ecee476ede872cc671c8fe4887eb6194d6b9ef85/Open-ILS/src/templates/opac/parts/searchbar.tt2#L65

Jane Sandberg (sandbej) on 2018-10-05
tags: added: opac
Jane Sandberg (sandbej) wrote :

I created a branch to make autofocus a lot more conservation. It is called: user/sandbergja/lp1796225_dont_autofocus_searchbar_on_non-search_pages

Here's a link: http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/sandbergja/lp1796225_dont_autofocus_searchbar_on_non-search_pages

And here are the testing notes from the commit message:

1) In the public catalog, visit the search results, record view, library details, basket, and password reset pages. Notice that the cursor leaps to the search bar in each of these pages.
2) Apply this commit.
3) Re-visit all those pages. Notice that the cursor no longer leaps to the search bar.
4) Visit the home page of the public catalog. Notice that the cursor still leaps to the search bar on this page only.

tags: added: pullrequest
Jane Sandberg (sandbej) wrote :

I meant conservative, not conservation! :-)

Changed in evergreen:
status: New → Confirmed
importance: Undecided → Medium
Terran McCanna (tmccanna) wrote :

Works like a charm!

I have tested this code and consent to signing off on it with my name, Terran McCanna, and my email address, <email address hidden>.

tags: added: signedoff
Michele Morgan (mmorgan) on 2018-11-19
Changed in evergreen:
milestone: none → 3.3-beta1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers