Problem/Motivation

The revisions overview page currently fails a11y testing because the link text is the same and are not differentiated with a title attribute and the radio buttons have no labels. Also related #2834253: Missing column headings in Revisions list.

Issue fork diff-3228798

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joel_osc created an issue. See original summary.

joel_osc’s picture

StatusFileSize
new3.43 KB

Here is a patch that adds text to the radios and title attributes to the revert and delete links.

joel_osc’s picture

Status: Active » Needs review
joel_osc’s picture

StatusFileSize
new1.95 KB

Shoot, wrong patch - here is the correct one.

joel_osc’s picture

Title: Make revsions oversion page accessible » Make revisions overview page accessible
miro_dietiker’s picture

Issue tags: +Accessibility

Great to see accessibility contributions, thank you!

Just a quick question:
Does this change anything in the static display to the user?
Or are all these titles invisible and only show on hover?

joel_osc’s picture

StatusFileSize
new224.72 KB

Hi @miro_dietiker, sorry I should have included a screenshot. Here is a screenshot of this patch along with the patch from #2834253: Missing column headings in Revisions list which is also needed for accessibility. There are changes to the static display: the first is labels on the radios, which I think also provides better usability. And the second is the tooltip (title attribute) shown on delete/revert links to differentiate them.

smulvih2’s picture

@joel_osc this is a great improvement! My only feedback is change "Version #xxx" with "Revision #xxx". For the buttons, something like "Delete revision #xxx" and "Edit revision #xxx".

joel_osc’s picture

StatusFileSize
new1.98 KB

Thanks @smulvih2, I totally agree. Here is a new patch with that text changed.

joel_osc’s picture

StatusFileSize
new3.97 KB

Noticed a small regression in that when the current row is selected on one column the label did not disappear along with the button on the other column. Patch updated.

smulvih2’s picture

Status: Needs review » Reviewed & tested by the community

Yep good call on the JS change, now I can't select a hidden radio with it's visible label. This looks good to me, including this patch in my project. Thanks!

phenaproxima’s picture

+++ b/src/Form/RevisionOverviewForm.php
@@ -258,14 +258,14 @@ class RevisionOverviewForm extends FormBase {
+                  Url::fromRoute('node.revision_revert_translation_confirm', ['node' => $node->id(), 'node_revision' => $vid, 'langcode' => $langcode], ['attributes' => ['title' => $this->t('Revert revision @vid', ['@vid' => $vid])]]) :
+                  Url::fromRoute('node.revision_revert_confirm', ['node' => $node->id(), 'node_revision' => $vid], ['attributes' => ['title' => $this->t('Revert revision @vid', ['@vid' => $vid])]]),

Question: I heard somewhere that using the title attribute on links is not the best a11y practice, and that it would be better to embed a hidden span in the link text (which can be done with the visually-hidden class that ships with core). Example:

$links['revert'] = [
  'title' => $this->t('Revert <span class="visually-hidden">revision @vid</span>', ['@vid' => $vid]),
  // ...etc.
];

Am I correct in this understanding? I'm far from an accessibility expert, so I don't feel comfortable committing this until someone with more chops than me has signed off on this one. Maybe I can loop in someone from the core accessibility team.

starshaped’s picture

This is correct. Using visually hidden is a better accessible experience than using a title on the link.

phenaproxima’s picture

Status: Reviewed & tested by the community » Needs work

Okay, kicking back for that adjustment, then! Sorry about that.

smulvih2’s picture

Status: Needs work » Needs review
StatusFileSize
new3.78 KB

@phenaproxima good call on title attribute VS invisible text. Patch attached implements your feedback.

edmund.dunn’s picture

This worked well for us!

silvi.addweb’s picture

StatusFileSize
new3.77 KB

re-roll patch according to the latest code changes.

acbramley’s picture

Status: Needs review » Needs work

Please update to use an MR

silvi.addweb’s picture

Status: Needs work » Needs review