π¨ Palette: Improve pagination accessibility - #2121
Conversation
Replaced nested `span.sr-only` screen reader text with explicit `aria_label` attributes on active `Link` components. For disabled pagination controls which fall back to standard `span` elements, added `role="button"` and `aria_disabled="true"` alongside the `aria_label` to correctly announce their interactive purpose and current state to assistive technologies. Co-authored-by: damacus <40786+damacus@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| aria_label: t('admin.users.pagination.previous'), | ||
| data: { turbo_frame: 'admin-users-frame' } | ||
| ) do | ||
| span(class: 'sr-only') { t('admin.users.pagination.previous') } | ||
| plain 'βΉ' | ||
| end | ||
| else | ||
| span(class: "#{nav_button_class('rounded-l-md')} opacity-50 cursor-not-allowed") do | ||
| span(class: 'sr-only') { t('admin.users.pagination.previous') } | ||
| span( | ||
| class: "#{nav_button_class('rounded-l-md')} opacity-50 cursor-not-allowed", | ||
| role: 'button', | ||
| aria_disabled: 'true', | ||
| aria_label: t('admin.users.pagination.previous') |
There was a problem hiding this comment.
π Pagination specs expect removed markup
Four pagination examples still require .sr-only children. The new ARIA attributes leave these tests failing and untested.
Was this helpful? React with π or π to provide feedback.
π‘ What
Updated the Admin Users
Paginationcomponent to use standardaria_labelattributes instead of visually hiddenspan.sr-onlytags. For disabled state wrappers, explicitly addedrole="button"andaria_disabled="true".π― Why
To improve semantic HTML and screen reader accessibility. Visually hidden spans nested inside generic elements (like
spantags used for disabled links) are often not interpreted as interactive controls by screen readers unless accompanied by explicit roles and states.πΈ Before/After
Before: (Disabled previous button)
After:
βΏ Accessibility
Ensured that disabled pagination controls are correctly announced as disabled buttons by screen readers rather than plain text nodes. Active links now use standard
aria-labelattributes instead of relying onsr-onlyCSS hacks.PR created automatically by Jules for task 1149261447878206447 started by @damacus