Add ARIA attributes to pagy_nav*
to improve default accessibility
#569
Replies: 8 comments 15 replies
-
The discussion would be very welcome. Feel free to note down any further pointers you have - especially with links to authoritative sources to aria guidelines / specs. |
Beta Was this translation helpful? Give feedback.
-
@wimdavies Great topic. I am definitely not an expert about ARIA stuff (and I have no time to become one): I only remember I merged the PR #412 from @sunny (which looks like in contrast with your first suggestion) and it would definitely be good to sort this out thoroughly and ensure a basic ARIA compliant output. Comments and contributions are welcome. |
Beta Was this translation helpful? Give feedback.
-
Thank you for opening this discussion 💜
Good call, my understanding from several articles was that
|
Beta Was this translation helpful? Give feedback.
-
About the What would be the added value of specifying "page" (that I suppose should also be translated) when the links are clearly already in a Is that really a benefit that is worth an extra entry translated in all the dictionaries and the performance cost of an extra ruby interpolation for every page link, adding an extra i18n lookup? |
Beta Was this translation helpful? Give feedback.
-
@wimdavies @sunny ok, so we can certainly include the changes not affecting CPU time, which are (so far):
The concern about the optimal HTML structure to support But if we tag the ARIA changes as a mayor version, we can change whatever without the risk of "surprising" anybody with unannounced breaking changes. If everyone agrees @benkoshy may want to create a new branch so we can coordinate easily and everyone can start working on one style at the time. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
The new
I temporarily disabled the rule in 724f491 @wimdavies @sunny @benkoshy : we are going to start the refactoring ASAP. Hoping to have your help. |
Beta Was this translation helpful? Give feedback.
-
ARIA milestone ready! Please, let me know if I missed something. |
Beta Was this translation helpful? Give feedback.
-
ARIA compliance is only missing a few translations and a bit of documentation for the extra key arguments of the helpers. The helpers have been refactored keeping into account the ARIA milestone. Please, try the |
Beta Was this translation helpful? Give feedback.
-
Hiya,
I've just used
pagy
for a beginner Rails project, and it's great — thank you for all your hard work.I noticed that while
pagy_nav
does supplyaria-label
s for the 'previous' and 'next' buttons, it doesn't provide other recommended ARIA attributes for navigation and pagination. Ifpagy
could implement a more comprehensive set of ARIA attributes, I feel it would significantly improve the default accessibility ofpagy_nav
output, and therefore (hopefully) that of all the sites that use it.Suggestions for changes:
<nav>
element should havearia-label="Pagination"
(source)<span>
element for the current page should havearia-current="page"
(source)aria-label="Page #{number}"
or similar label (source)aria-disabled="true"
state (source)<a>
tag in the DOM, and giving its parent<span>
the relevant inner text. I'm not sure whether this is good practice from an accessibility standpoint, and maybe this is one of the cases where 'one may want users to find these elements through standard keyboard navigation, though the functionality of that control is removed or "disabled"'. If so, it might be better to shift towards keeping the<a>
element and setting it toaria-disabled="true"
(along with other relevant changes)?Disclaimer: I'm a recent bootcamp graduate, so I'm not speaking from a position of any particular expertise; I just care about accessibility. I'd welcome any further discussion on this issue.
Beta Was this translation helpful? Give feedback.
All reactions