Page MenuHomePhabricator

Fix aria-label for when 'text' is empty
Closed, ResolvedPublicBUG REPORT

Description

As reported by Dom:

FYI, the aria-label is constructed using the text parameter of the phonos tag. So <phonos text="foo" /> generates an aria-label=Listen to the IPA pronunciation of foo.

Bear in mind that the text parameter is not always required in a phonos tag. For example, <phonos file="foo.ogg" /> will generate an aria-label that is just Listen to the IPA pronunciation of .

And Volker suggested making the text attribute required:

That makes me think, should text param always be required and the documentation be amended in this way?
Not that we're ending up in a similar problematic situation as with missing alt text on images, as people didn't start adding it from the beginning making the elements inclusive to vision-enabled users only.

Open questions:

  • Should text be required?
  • If it's not, should we use ipa if it's available? e.g. `Listen to the IPA pronunciation of lænˈdɪdnoʊ.'
  • What should be done when file is used? Perhaps make text required in this case?

Acceptance criteria:

  • aria-label attribute is not incomplete: Listen to the IPA pronunciation of .

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I don't think we need to necessarily make it mandatory, if that'd only be to give aria-label something to display. We could just re-phrase it a bit when there's no text, e.g. "Listen to the IPA pronunciation of this word or phrase."

But if it's like alt text, then maybe it's good to always have a text label of what the audio is for?

Change 886315 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/Phonos@master] Move aria-label to be on anchor, and remove `text` from it

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

Change 886315 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Move aria-label to be on anchor, and remove `text` from it

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

The label is now "Listen to the pronunciation of this word or phrase." in all cases.

As a screen reader user, I'd prefer "Listen to pronunciation" ... or something; much snappier.

Change 890948 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/Phonos@master] Shorten aria-label for PhonosButtons

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

As a screen reader user, I'd prefer "Listen to pronunciation" ... or something; much snappier.

@Graham87 What about the case when you have multiple IPA pronunciations on a page, for example for Australian vs. British English? Are people going to be able to distinguish them?

@Graham87 What about the case when you have multiple IPA pronunciations on a page, for example for Australian vs. British English? Are people going to be able to distinguish them?

Yes, by the surrounding context.

Note that when file= is used, the audio is not necessarily of a pronunciation.

@Nardog I think your suggestion of "Play audio" is good.

Is it worth making the label customizable? So that more specific details could be provided when required? e.g.

<phonos file="intro.mp3" aria-label="Listen to the opening bars of the piece" />

Is it worth making the label customizable? So that more specific details could be provided when required? e.g.

<phonos file="intro.mp3" aria-label="Listen to the opening bars of the piece" />

I doubt it given what @Graham87 said above. If it is not obvious what the audio is about without the label, then it's probably not obvious to sighted readers either. It couldn't hurt to make it customizable, but it might accidentally invite overexplanation that doesn't actually help screenreader users. Obviously deferring to Graham (or anyone else using screenreaders or with experience in accessibility development) though.

Is it worth making the label customizable? So that more specific details could be provided when required? e.g.

<phonos file="intro.mp3" aria-label="Listen to the opening bars of the piece" />

Nah, probably not worth it. Most people won't customise what they can't see.

Change 890948 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Shorten aria-label for PhonosButtons

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

The aria-label is now "Play audio" (with some exceptions noted in T330851).

@Graham87 just checking you are OK with the change of wording.

If a file is passed to Phonos we don't know whether it is a recording of a pronunciation or not. However, if ipa and text are passed without a file we can be pretty sure it is meant to be a pronunciation. Perhaps we could show different aria-labels based on this condition.

@Graham87 just checking you are OK with the change of wording.

Sure, sounds good.

If a file is passed to Phonos we don't know whether it is a recording of a pronunciation or not. However, if ipa and text are passed without a file we can be pretty sure it is meant to be a pronunciation. Perhaps we could show different aria-labels based on this condition.

No need, I don't think
; "Play audio" works everywhere.

dom_walden moved this task from QA 🐛 to Done 🏁 on the Community-Tech (CommTech-Sprint-41) board.

If a file is passed to Phonos we don't know whether it is a recording of a pronunciation or not. However, if ipa and text are passed without a file we can be pretty sure it is meant to be a pronunciation. Perhaps we could show different aria-labels based on this condition.

No need, I don't think
; "Play audio" works everywhere.

Thank you.