Page MenuHomePhabricator

Table, i18n: improve caption message for assistive tech
Closed, ResolvedPublic1 Estimated Story Points

Description

In the Table component, there is a visible "caption" (that actually exists outside the <table> element and is hidden from assistive technology), and a visually-hidden <caption> element that contains the caption text. When a table is sortable, a string is appended to the visually-hidden caption to explain to users of assistive technology that sortable columns have a button (that sorts the column when clicked)

image.png (1×1 px, 189 KB)

@Aaharoni-WMF, who recently helped us when we introduced Codex messages into MediaWiki core, noted that the syntax of this message is not correct nor ideal. In English, a comma separating the caption from the appended clause is not grammatically correct, and a period or parentheses would be more ideal.

We originally took this syntax from the WAI's ARIA Authoring Practices Guide (APG). Amir presented this to them and they agreed that the syntax should be changed - see the GitHub issue. They fixed the guide, and the new version is published at https://www.w3.org/WAI/ARIA/apg/patterns/table/examples/sortable-table/. The comma is replaced with parentheses.


Acceptance criteria

  • Update the syntax in the default value for the cdx-table-sort-caption message in the Table component (the second argument of the useI18n() call) to ${ caption } (column headers with buttons are sortable).
const translatedSortCaption = useI18n(
    'cdx-table-sort-caption',
    ( caption ) => `${ caption }, column headers with buttons are sortable.`,
    [ toRef( props, 'caption' ) ]
);
  • Update the English version of the cdx-table-sort-caption message in MediaWiki core (in languages/i18n/codex) to $1 (column headers with buttons are sortable).

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
AnneT updated the task description. (Show Details)

Change #1074462 had a related patch set uploaded (by Amire80; author: Amire80):

[mediawiki/core@master] Update cdx-table-sort-caption punctuation

https://gerrit.wikimedia.org/r/1074462

Amire80 edited subscribers, added: Amire80; removed: Aaharoni-WMF.

Update: The W3C have accepted my proposal. They fixed the guide, and the new version is published at https://www.w3.org/WAI/ARIA/apg/patterns/table/examples/sortable-table/ . The comma is replaced with parentheses.

I made a patch to update the translatable message. I omitted the full stop because it seems really unnecessary in English, but if anyone thinks that it's necessary, put it in. This patch doesn't fully resolve the bug because there are a few more appearances of "column headers with buttons are sortable" after a comma, and since I know very little about Vue, I'm not sure how to fix them.

CCiufo-WMF updated the task description. (Show Details)
CCiufo-WMF moved this task from Backlog to Needs Refinement on the Design-System-Team board.
CCiufo-WMF added a subscriber: Aaharoni-WMF.
CCiufo-WMF subscribed.

Thanks for the update @Amire80! We'll try to complete the rest of this task in an upcoming sprint.

CCiufo-WMF triaged this task as Medium priority.Sep 23 2024, 2:57 PM
CCiufo-WMF set the point value for this task to 1.Sep 25 2024, 5:05 PM

Change #1082059 had a related patch set uploaded (by LWatson; author: LWatson):

[design/codex@main] Table, i18n: improve caption message for a11y

https://gerrit.wikimedia.org/r/1082059

lwatson changed the task status from Open to In Progress.Oct 21 2024, 8:30 PM
lwatson updated the task description. (Show Details)

With the proposed changes, the screen reader (for example VoiceOver) reads aloud:

Entering Contributions (column headers with buttons are sortable). table. Username, button, group, Contributions (column headers with buttons are sortable)., table, 5

The caption which ends in a period is followed by a comma. This ., doesn't disrupt the flow of the text. Both signal a pause. Could this be problematic?

Change #1074462 merged by jenkins-bot:

[mediawiki/core@master] Update cdx-table-sort-caption punctuation

https://gerrit.wikimedia.org/r/1074462

Change #1082059 merged by jenkins-bot:

[design/codex@main] Table, i18n: improve caption message for a11y

https://gerrit.wikimedia.org/r/1082059

Test wiki created on Patch demo by ATomasevich (WMF) using patch(es) linked to this task:
http://patchdemo.wmcloud.org/wikis/a5d0a31f72/w/

Test wiki on Patch demo by ATomasevich (WMF) using patch(es) linked to this task was deleted:

http://patchdemo.wmcloud.org/wikis/a5d0a31f72/w/