Page MenuHomePhabricator

[MEX] 🚧 a11y errors occur in editStringDatatypes cypress test for commons media in some local environments
Closed, ResolvedPublicBUG REPORT

Description

At least 3 of us (@AudreyPenven_WMDE, @Sadiya.Mohammed_WMDE, @ArthurTaylor) have gotten accessibility violations when running cypress tests locally. The failing test is for editing commons media statements in editStringDatatypes.cy.ts. The img tag is missing alt-text, and a link is missing text. It can be observed by running npm run cypress:run or npm run cypress:open in the Wikibase directory.

Screenshot From 2026-02-24 18-08-26.png (1,592×1,022 px, 354 KB)

As far as we're aware, all relevant repos are on the latest master and everything is up to date. However, not everyone is able to reproduce this issue (@mahmoud.abdelsattar.wmde, for example, tried and could not). The error also does not occur in ci.

Since this is affecting multiple team members, we should investigate this further and find a fix. However unlikely, we should also confirm that this isn't a bug waiting to hit production.

Event Timeline

ArthurTaylor renamed this task from [MEX] a11y errors occur in editStringDatatypes cypress test for commons media in some local environments to [MEX] 🚧 a11y errors occur in editStringDatatypes cypress test for commons media in some local environments.Mar 2 2026, 8:34 AM
ArthurTaylor claimed this task.
ArthurTaylor moved this task from The Backlog to The Board on the Wikidata-Omega board.
ArthurTaylor edited projects, added: Wikidata-Omega (The Board); removed: Wikidata-Omega.

Change #1247030 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Provide alt-text in CommonsInlineImageFormatter

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

Change #1247938 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/core@master] Add aria-labelledby option to ThumbnailImage

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

When we have a statement on an item on Wikidata like the attached - an image on commons - our accessibility testing tools tell us (quite reasonably) that the image is missing an alt-text attribute. You can see that the image is labelled with its filename, and we could make that the label (with aria-labelledby), but @Lucas_Werkmeister_WMDE has the concern that a filename isn't, in fact, a description of the image.

2026-03-05-091948_743x469_scrot.png (743×469 px, 33 KB)

It is possible to give images in commons descriptions, but it would be relatively complex to extract that for this use case, and the description isn't always present.

@Alice.moutinho what would be your preferred solution here?

After evaluating all possibilities at hand, i think it is better to hardcode the alt-text to say "image" (if it is always an image) or "media" if there are also types of media included. Like this the user using a screen reader at least gets some context before hearing the file name, that in this case makes sense with the image but sometimes could be something non descriptive like "IMG_23567.svg".

But this is a quick fix, we should properly address this problem once we have capacity - so a follow up ticket would be great!

We will silence the tool issue for now

Move the ticket to M5 and create a follow up ticket that will investigate a solution that addresses the issue.

Related task: T325955

Change #1251050 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Silence a11y warnings about missing alt-tags for commonsMedia

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

Change #1247030 abandoned by Arthur taylor:

[mediawiki/extensions/Wikibase@master] Use aria-labelledby attribute in CommonsInlineImageFormatter

Reason:

prefer I6ab2cb0c248a71d8aaddc78619919ac06a6a6964

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

Change #1247938 abandoned by Arthur taylor:

[mediawiki/core@master] Add aria-labelledby option to ThumbnailImage

Reason:

prefer I6ab2cb0c248a71d8aaddc78619919ac06a6a6964

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

Change #1251050 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Silence a11y warnings about missing alt-tags for commonsMedia

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

Technical verification: The applied solution sounds reasonable, I'm unable to test it locally because it is working fine from the beginning.
I'm passing this issue to Done and will check the follow-up task.
Thank you!