Make WordPress Core

Opened 11 years ago

Closed 6 weeks ago

Last modified 10 days ago

#32892 closed defect (bug) (fixed)

List table: Select %s shouldn't be a row header

Reported by: afercia Owned by: joedolson
Priority: normal Milestone: 7.1
Component: Administration Version: 4.2
Severity: normal Keywords: has-patch has-test-info has-dev-note
Cc: Focuses: ui, accessibility

Description

See related #31654 and #26167.

In all the List Tables in the admin, the "Select %s" (where %s is the name of the Post, Attachment, Plugin, User, etc,) is used as row header:

<th scope="row" class="check-column">

This is not correct from a semantics and accessibility point of view for all the reasons mentioned in #31654. The row header should be the cell with the main object the table refers to: the Post title, the Plugin name, etc.

We could also consider to use the abbr attribute: http://www.w3.org/TR/html5/tabular-data.html#attr-th-abbr
that would be consistent with what is currently proposed in sortable column headers ticket

Attachments (5)

32892.patch (1.9 KB ) - added by abcd95 15 months ago.
rought implementation
32892 title cell name with aria-label.png (176.8 KB ) - added by afercia 3 months ago.
Testing with aria-label added to the row header cell
32892 title and title.png (162.0 KB ) - added by afercia 3 months ago.
Edit link announced as Title and Title…
before.png (166.6 KB ) - added by ozgursar 2 months ago.
Before patch 9761
after.png (157.8 KB ) - added by ozgursar 2 months ago.
After patch 9761

Download all attachments as: .zip

Change History (45)

#1 @afercia
11 years ago

  • Owner set to afercia
  • Status newassigned

#2 @afercia
10 years ago

  • Keywords 4.4-early removed

One more good reason to address this issue is that, when a post is locked and the lock icon appears, the icon has no label or text that can be announced so screen readers will read out the column header "Select All";

https://cldup.com/KBazRCctl3.png

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


10 years ago

#4 @afercia
8 years ago

  • Owner afercia removed

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


17 months ago

@abcd95
15 months ago

rought implementation

#6 @abcd95
15 months ago

  • Keywords needs-patch removed

Added in [15622]

This is a rough implementation and a thought put into existence. This doesn't account for the styling and CSS ruleset changes. I want opinions on whether this is the right direction to move forward.

Last edited 15 months ago by abcd95 (previous) (diff)

This ticket was mentioned in PR #9761 on WordPress/wordpress-develop by @abcd95.


12 months ago
#7

  • Keywords has-patch added

@abcd95 commented on PR #9761:


12 months ago
#8

Other list tables, such as the Users list and multi-site tables, are yet to be updated. Additionally, the styling has been affected, which I will address in the subsequent commits.

@abcd95 commented on PR #9761:


12 months ago
#9

The styles of the plugins list table and highly coupled, and removing padding on unselected rows is affecting other headers. Debugging deeper into this -

https://github.com/user-attachments/assets/40799432-d840-45df-a424-ca097078949d

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


10 months ago

#11 follow-up: @joedolson
10 months ago

  • Milestone Future Release7.0

Thanks for your work on this, @abcd95!

I think that the direction is valid, although I'm a little concerned that that row actions will pollute the name too much. That might need testing with users, to see if it's too annoying.

The excerpt is also in the name cell in extended view, and that could make it even worse.

#12 in reply to: ↑ 11 @abcd95
10 months ago

Replying to joedolson:

I think that the direction is valid, although I'm a little concerned that that row actions will pollute the name too much.

Thanks for the feedback, @joedolson

Regarding the concerns about row actions and excerpts "polluting" the name cell -
You're right that this warrants testing. The row actions are semantically related to the row item (title/name), so having them within the <th scope="row"> makes logical sense from an accessibility standpoint (I'm gonna defer to your judgement here tho). I also understand your concern about the verbosity.

Could we -

  • Explore using aria-labelledby or aria-describedby to separate the core identification (title) from supplementary content (actions/excerpt)
  • Consider moving the excerpt outside the <th> into a separate <td> in a new row (similar to how plugin descriptions work)

Looking forward to what other contributos have to say about this. Thanks for helping out with this one.

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


8 months ago

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


7 months ago

#15 @joedolson
6 months ago

  • Milestone 7.07.1

This hasn't gotten the attention it needs for 7.0, so I'm moving it to 7.1. I think this is a reasonable follow after some of the other work I've done on list tables in 7.0, so it's a good candidate for the next release.

#16 @afercia
3 months ago

I tested a bit the linked PR at https://github.com/WordPress/wordpress-develop/pull/9761

Seems to me it's moving to a good direction. A couple things:

Explore using aria-labelledby ...

@abcd95 I'd encourage to explore aria-label. I tried adding it to the title cell, e.g.:

<th aria-label="' . esc_attr( $post->post_title ) . '" scope="row" ...

That way, the cell name is way cleaner and screen readers would announce a clean row header. See attached screenshot. However:

  • We should make sure aria-label doesn't have any impact on the announcement of the row action links and other content of the cell. This should be tested with the most popular combinations of browsers and screen readers.
  • My quick try was made by changing the _column_title method in the sub class for the posts. That works but isn't ideal because it delegates the responsibility to the sub classes. We can take care of the ones used in core but custom classes used by plugins wouldn't necessarily follow this pattern. Ideally, the parent class should be responsible to add the aria-label.
  • I'm not sure the use of abbr in the PR is actually useful but we could double check that later.

Lastly, I'm not sure why the link to the post in the cell is announced by prepending 'Title and Title'. See second screenshot. This should be investigated.

Last edited 7 weeks ago by afercia (previous) (diff)

@afercia
3 months ago

Testing with aria-label added to the row header cell

@afercia
3 months ago

Edit link announced as Title and Title...

#17 @afercia
3 months ago

To clarify the first screenshot above:

  • Use a screen reader.
  • Navigate the 'Author' column vertically by using arrow keys.
  • When moving to a new row, observe the Title cell, which is now the row header, is announced cleanly by referencing only the post title.

This ticket was mentioned in Slack in #core-test by nikunj8866. View the logs.


2 months ago

@ozgursar
2 months ago

Before patch 9761

@ozgursar
2 months ago

After patch 9761

#19 @ozgursar
2 months ago

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/9761

Environment

  • WordPress: 7.1-alpha-62161-src
  • Subdirectory: No
  • PHP: 8.2.29
  • Server: nginx/1.29.4
  • Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
  • Browser: Safari 26.5.2
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.3.0

Steps taken

  1. Add 2 or more posts
  2. Go to posts list and using Chrome Dev Tools, observe the title column as <th scope=" row" class="check-column">
  3. Using screen reader head over to second row's title column. (In my case I used Safari and MacOS's built-in Voice Over)
  4. Observe the title column announced as "row 3 of 4 Select Post1 and Select Post1 link, Post1" (see screenshot - before)
  5. Apply patch
  6. Repeat step2 and observe the same row which appears as "<th scope=" row" class="title column-title has-row-actions column-primary page-title" data-colname="Title" aria-label="Post1"
  7. Using the screen reader, navigate to the post title from the previous row and observe that it's announced as "Title Post1, link, Post1, column 2 of 3" this time. (see screenshot - after)
  8. ✅ Patch is solving the problem

Expected result

  • Having aria-label and other additional attributes help screen readers output better results with improved accessibility.

Screenshots/Screencast with results

Before:
https://core.trac.wordpress.org/raw-attachment/ticket/32892/before.png

After:
https://core.trac.wordpress.org/raw-attachment/ticket/32892/after.png

This ticket was mentioned in Slack in #core-test by nikunj8866. View the logs.


2 months ago

#21 @nikunj8866
2 months ago

  • Keywords has-test-info added

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


7 weeks ago

#23 @joedolson
7 weeks ago

  • Keywords needs-dev-note commit added

I added some missing CSS to fix the alignment of the checkbox, and a fallback "no title" to use as the aria-label when the post is untitled, as it otherwise omitted the aria-label.

I wasn't able to reproduce the Title and Title Block... announcement that @afercia got; the closest I could get was when arrowing into the sortable columns, the sort column type is announced from the column header. But that's generally just "Title" or "Title + sort type"; so that's only part of the result.

However, I think that this is a clear improvement on what we have now, and worth implementing. It will need a dev note, as this could impact extenders targeting th.check-column.

#24 follow-up: @joedolson
7 weeks ago

I tested this technique on Windows, as well, and it works in JAWS, but not in NVDA. There's an issue for this on NVDA, but it's closed as not planned, so it's unlikely to change soon.

https://github.com/nvaccess/nvda/issues/17213

In my opinon, this is still better than the existing behavior, even with the excess verbosity. Users can stop their screenreader by moving on, and the first content announced is still the post title information, so the relevant information is conveyed immediately. This is better than the clearly inaccurate 'Select [post title]'.

#25 @joedolson
7 weeks ago

  • Owner set to joedolson
  • Status assignedaccepted

#26 in reply to: ↑ 24 @afercia
7 weeks ago

Replying to joedolson:

I tested this technique on Windows, as well, and it works in JAWS, but not in NVDA. There's an issue for this on NVDA, but it's closed as not planned, so it's unlikely to change soon.

In my opinon, this is still better than the existing behavior ...

I'd agree. I commented on the NVDA issue, kindly asking for reconsideration.

#27 @joedolson
7 weeks ago

  • Resolutionfixed
  • Status acceptedclosed

In 62838:

Administration: Use post title column as table header in post lists.

The select column has been the th with row scope for post list tables since at least 2010. This results in a row name for screen readers that is based on the checkbox input and its label, which can be an empty value when that input is not available.

Move the th to the post title column, change the select column to td, and add aria-label to the th to provide a simplified row name to supporting screen readers.

Styles are additive, to retain support for custom list table implementations.

Developed in https://github.com/WordPress/wordpress-develop/pull/9761

Props afercia, abcd95, ozgursar, nikunj8866, joedolson.
Fixes #32892.

#28 @joedolson
7 weeks ago

  • Resolution fixed
  • Status closedreopened

Re-opening to follow up with overlooked JS changes.

This ticket was mentioned in PR #12666 on WordPress/wordpress-develop by @joedolson.


7 weeks ago
#29

Follow up due to overlooked JS changes.

Trac ticket: https://core.trac.wordpress.org/ticket/32892

## Use of AI Tools

#30 @TobiasBg
7 weeks ago

@joedolson: It also appears that this has changed the styling of e.g. the cells in the "Title" column of the Posts and Pages screens.

These previously were tds which had

.widefat td {
	vertical-align: top;
}

applied to them. Now, as th, they no longer have that vertical alignment so that they are moved a bit down.

#31 @joedolson
7 weeks ago

Yes, I see that - in my test environment, none of the rows had greater height than the title fields, so that wasn't obvious. Will fix at the same time. Thanks!

#32 @joedolson
7 weeks ago

  • Resolutionfixed
  • Status reopenedclosed

In 62839:

Administration: Update bulk edit validity checks & CSS.

Omitted to update the scripting validating bulk edit selections when changing the list table th. Add overlooked CSS to set post title th to vertical-align: top. Follow up to [62838].

Developed in https://github.com/WordPress/wordpress-develop/pull/12666

Props joedolson, tobiasbg.
Fixes #32892.

#33 @afercia
7 weeks ago

  • Resolution fixed
  • Status closedreopened

It's nice to see this merged.

As a follow-up, I would like to propose to improve a few other tables. In these tables, the th row header is now correctly the cell of the primary column. However, there's no aria-label set on the th so that the accessible name still contains redundant, noisy, content (row actions and the like).

Here's the tables that would benefit from the aria-label:

  • 'WP_Media_List_Table' in Media Library > List view
  • 'WP_Terms_List_Table' e.g. Categories and Tags
  • 'WP_MS_Sites_List_Table' in Network Admin > Sites
  • 'WP_MS_Users_List_Table' in Network Admin > Users
  • 'WP_Privacy_Data_Export_Requests_List_Table' in Tools > Export Personal Data
  • 'WP_Privacy_Data_Removal_Requests_List_Table' in Tools > Erase Personal Data

If no objections, I'll try to submit a new PR for them.

Additionally, there are a few special cases. Some of them don't need any action, mentioning them for completeness:

'WP_Application_Passwords_List_Table' in Edit User / Useer Profile > Application Passwords
When first created via AJAX, the cell with the App name is a <td>. Only after refreshing the page is a <th>. I will create a separate ticket.

'WP_Comments_List_Table' in Comments
The row header is the 'Comment' cell. I think that's fine, open to suggestions.

'WP_Post_Comments_List_Table' in Classic Editor, must be enabled from Screen Options, it is rendered when manually adding a comment in the edit post screen.
As above, the row header is the 'Comment' cell.
However, the table does not have a thead with column headers. Open to suggestions.

'WP_Links_List_Table' in Links Manager, hidden for new installs since WordPress 3.5. To re-enable it, see the plugin https://wordpress.org/plugins/link-manager/. If the fix is trivial, I'd vot eto fix it.

'WP_Plugin_Install_List_Table' in PLugins > Add Plugins
Does not use a table.

'WP_Themes_List_Table' I believe it's no longer used by core, kept for backward compatibility.
'WP_Theme_Install_List_Table' I believe it's no longer used by core, kept for backward compatibility.

This ticket was mentioned in PR #12683 on WordPress/wordpress-develop by @afercia.


7 weeks ago
#34

Trac ticket: https://core.trac.wordpress.org/ticket/32892

Adds aria-label attributes to more list table row headers, to provide cleaner names for screen reader users.
Corrects @since notation after changeset 62838.

## Use of AI Tools

None

#35 @afercia
7 weeks ago

  • Keywords commit removed

https://github.com/WordPress/wordpress-develop/pull/12683 adds aria-labels to more list table row headers.
Also, corrects @since notation after [62838].

The added labels build on top of [62838], just implementing the provided method get_primary_column_aria_label(). Review welcome.

#36 @afercia
6 weeks ago

  • Resolutionfixed
  • Status reopenedclosed

In 62868:

Administration: Add aria-label attributes to row headers in more list tables.

Follow-up to [62838].
Provides screen readers with a cleaner name as the row header name, preventing them from computing the name from the full cell content.

Developed in https://github.com/WordPress/wordpress-develop/pull/12683

Props afercia, mukesh27, joedolson.
Fixes #32892.

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


6 weeks ago

This ticket was mentioned in Slack in #core by tyxla. View the logs.


5 weeks ago

#39 @milana_cap
5 weeks ago

  • Keywords has-dev-note added; needs-dev-note removed

#40 @afercia
10 days ago

In 63398:

Administration: Render a table row header in the Application Passwords AJAX row template.

Tables extending WP_List_Table use a <th scope="row"> element as the row
header for the primary column. WP_List_Table::single_row_columns() renders
this for server-generated rows, but the JavaScript template used when a new
application password is created via AJAX rendered every cell as a <td> element,
leaving the row header missing until the page was reloaded.

Renders the primary column of the JavaScript row template as a
<th scope="row"> element, mirroring the server-generated markup.

Props khokansardar, mukesh27, afercia.
See #32892.
Fixes #65707.

Note: See TracTickets for help on using tickets.