You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should we autofocus the search bar on PyPI homepage?
We have had many requests (and some PRs) from PyPI users to autofocus the search bar on the PyPI homepage.
As part of the work funded by the recent OTF grant, I have been researching whether or not this is a good decision to make from an accessibility perspective. Skip to conclusion.
Accessibility guidelines
To ensure that PyPI works for all users, our objective is to make PyPI WCAG 2.0 AA compliant.
Regarding autofocus, the relevant WCAG guideline is:
“Guideline 2.4 Navigable: Provide ways to help users navigate, find content, and determine where they are.”
and criterion:
2.4.3 Focus Order: If a Web page can be navigated sequentially and the navigation sequences affect meaning or operation, focusable components receive focus in an order that preserves meaning and operability. (Level A).
The key point in the criterion is that information should be presented:
in an order that is consistent with the meaning of the content
In the case of the PyPI homepage, it could be argued that as a primary task on the page, adding autofocus to the search is consistent with the meaning of the content. However, this would come down to the interpretation of the accessibility auditor.
Do not set initial focus when the page loads except in cases where:
The page offers a single, primary function that nearly all users employ immediately after page load.
Any given user is likely to use the page often.
Assessing the recommendation
To assess this recommendation it is useful to look at the way that the PyPI homepage is currently used by our community.
Notes:
Data source: Google Analytics
Dates studied: 1 June 2018 - May 31 2019 (last 12 full months)
Does the page offers a single, primary function that nearly all users employ immediately after page load?
Data: 52.9% of the time, PyPI users move from the homepage to the search result page, meaning that they use the search bar. 38.6% of the time people leave the page, leaving 8.5% of the time where users do something else (e.g. login, register, go directly to a project, etc.)
Result: Failure
Reason: 8.5% of the time, users do something other than search (or leave). This is a substantial enough percentage to fail the "nearly all" recommendation. The page also fails to have a "single, primary function" - as users can do many other things on the page other than search.
Is any given user likely to use the page often?
Data: Over the last 12 months, the PyPI homepage received more "returning visitors" (circa 1.8 million) than "new visitors" (circa 1.6 million). Globally (e.g. all PyPI pages, not just the homepage), the average number of sessions (visits) per user is 2.28.
Result: Failure
Reason: While the data shows that visitors to the PyPI homepage are mostly return users, nearly half of all visitors are first timers - suggesting that they are not likely to "use the page often". Additionally, the average PyPI user only visits the site 2.28 times per year.
Conclusion
Based on the WCAG guidelines and ARIA recommendations, and the way that the PyPI homepage is currently used, we should not autofocus the search bar on the PyPI homepage.
However, we will consider implementing a keyboard shortcut for users to move directly to the search bar. I will open another ticket to discuss this matter separately.
The text was updated successfully, but these errors were encountered:
pypi
locked as too heated and limited conversation to collaborators
Jun 25, 2019
Should we autofocus the search bar on PyPI homepage?
We have had many requests (and some PRs) from PyPI users to autofocus the search bar on the PyPI homepage.
As part of the work funded by the recent OTF grant, I have been researching whether or not this is a good decision to make from an accessibility perspective. Skip to conclusion.
Accessibility guidelines
To ensure that PyPI works for all users, our objective is to make PyPI WCAG 2.0 AA compliant.
Regarding autofocus, the relevant WCAG guideline is:
and criterion:
The documentation for this criterion can be found here, while the failure information is found here.
Meeting the guidelines
The key point in the criterion is that information should be presented:
In the case of the PyPI homepage, it could be argued that as a primary task on the page, adding autofocus to the search is consistent with the meaning of the content. However, this would come down to the interpretation of the accessibility auditor.
After more digging, I found a recommendation in the WIA Aria best practices document that provides clearer guidelines:
Assessing the recommendation
To assess this recommendation it is useful to look at the way that the PyPI homepage is currently used by our community.
Notes:
Does the page offers a single, primary function that nearly all users employ immediately after page load?
Is any given user likely to use the page often?
Conclusion
Based on the WCAG guidelines and ARIA recommendations, and the way that the PyPI homepage is currently used, we should not autofocus the search bar on the PyPI homepage.
However, we will consider implementing a keyboard shortcut for users to move directly to the search bar. I will open another ticket to discuss this matter separately.
The text was updated successfully, but these errors were encountered: