Improve accessibility of Views table sortable columns

Created on 7 March 2019, over 5 years ago
Updated 31 May 2023, about 1 year ago

Problem/Motivation

Currently views table columns are read by screen readers in a way that is not helpful to users. A table column named "Status" would be read as "Status sort descending" which is both hard to understand and doesn't state the actual status of the column, only the action of the link. Some help text is given in a title tag, but title has been widely panned for no longer being an accessibility best practice:

Proposed resolution

I recommend both changing the title tag to one that's read: aria-label, and supplementing the help text with more descriptive content based on these examples:

The aria-label on columns could work like:

(unsorted) 'Status' column. Activate to sort descending.
(active, sorted) 'Status' column, sorted descending. Activate to sort ascending.

The column name is wrapped in single quotes to be set off as not part of a sentence by the screen reader. If the column is sorted, the sort is indicated. Then the link action is indicated using "activate" instead of "click" to be pertinent to all users, whether they're navigating by keyboard, mouse, or another device.

Remaining tasks

I've tested in VoiceOver, but the behavior should be tested in other screen readers. The code isn't the DRYest... but it seemed like this was easier to read then chunking it up and concatenating the pieces together.

User interface changes

No visual changes, but changing what seems to be an unusable title tag into something more accessible.

API changes

None.

Data model changes

None.

Release notes snippet

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 4 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States froboy Chicago, IL

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024