-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use aria-labelledby for figures instead of alt/aria-label #1627
base: master
Are you sure you want to change the base?
Conversation
I've recently been experimenting with aria-labelledby and aria-describedby for MathML formulas and they seem quite workable, though what screen readers end up doing with them can be a bit inconsistent - and may be worth examining across AT tools. If I'm reading one tutorial on accessible images correctly, the basic reality for latexml is that we don't have enough information to set the An ideal alt image for a scientific plot may be e.g. " a loglog line plot with X axis going from 0 to 10,000 and Y axis going from -1 to 1. First data series covers ...", essentially narrating the details of the plot components. While some neural approaches have gotten quite good at this for imagenet images, we'd need some novel research to get that for diagrams. Or let authors do this as you've suggested in #1452 . So for now an empty Would the |
Should Note that there is also (Necessary reference: https://www.w3.org/TR/wai-aria/#aria-labelledby. ) |
Do we even need the label? I think that serves a similar purpose to the I think the only attribute we can try to set is the Unless the author adds annotations, or we do some new research magic to auto-generate what the figure Edit: Note on practical realities. It turns out one is best off double-checking any claims about the way attributes are meant to be used by their specs with the concrete AT tools that exist today in 2021, so that we merge PRs that deliver quality of life improvements to real people today. I had to learn this the hard way for the |
I am checking my old PRs, trying to make sense of them... and making sense of the ARIA attributes is quite hard! The additional challenge I didn't notice is that Suggestion: can we just add an ID to the caption, so that users have the options to change the behaviour via XSLT? |
I am still not sure the figure I also still do not know - but would like to eventually find out - what AT implementations currently do for the various suggested uses of ARIA, as well as for a simple img and figcaption combination without ARIA. But that requires me to get a Windows installation with NVDA or JAWS to check the mainstream vendors, which I am not yet technically prepared to do... So, instead, I checked what some legitimate modern e-journal platforms do today, using the browser inspector. Some examples with links to randomly sampled articles:
So I think this somewhat confirms to use I have now also seen the dedicated infobox @xworld21 mentioned, which warns to use
Curious, I hadn't realized the captions don't have IDs, not even when explicitly requested via I'm somewhat neutral on the general question, but see no reason to prohibit ids on |
I'm not sure why ids on things inside non-id'd captions is "funny"; you can still reach the caption using any other selector or xpath mechanism, which works for everything except aria (which is somehow a recurring theme, isn't it?). Somehow putting ids on captions is uncomfortable; most things with ids have some kind of referencing mechanism associated. Most latex-y things cooperate with Is it reasonable to leave the id creation up to the XSLT? |
I was already in a "funny mood" due to the way Nature was doing something similar that is correct on an operational level, but has entertaining semantics. In: <figcaption><b id="rc-Fig1">
Fig. 1: Antarctic coastal change since 1997.</b></figcaption> where the <figcaption><span id="span.id.N">...some caption text...</span></figcaption> It is not technically wrong, but it is - at the least - conceptually a bit funny. ARIA has indeed made the choice of working exclusively with the global All that said, I think we can focus on the improved |
Somehow I did not think I could generate the id from XSLT. That's a very appropriate solution on the user side, no need for new code in latexml.
I used to do occasional testing with VoiceOver, ChromeVox, TalkBack. I also have a laptop with NVDA now, but I haven't figured it out yet. I could try again on the journals you mentioned. Given the latest |
Hi all. I wanted to add a follow-up comment here to my small survey of what publishers do with alt-text on figures in 2022, as I found a modern example, advertised by ACM on twitter. The annotation is at this article: Here is a screenshot from the browser inspector over Figure 1: ACM uses used as: \begin{figure}
\includegraphics{figure1.svg}
\caption{Your figure caption here.}
\label{fig:label}
\Description{A full description of the image here}
\end{figure} Maybe we should try to find a way to connect them to the LaTeX team's official efforts towards creating new techniques for annotating accessibility, given that they have some prior work in LaTeX authoring? |
I'm probably missing a lot of subtlety in the discussion, but given all the developments, I'm wondering if we don't have a decent solution sketched out here?
Does that get us close to reasonable, if not perfect, accessibility? |
My position here continues to be:
I think we don't have enough macros at present to do this right, and we may hardwire some pieces together that will seem unfortunate in the long run. For an author who truly wants to add accessible descriptions to their figures, the final HTML result will likely have the caption as an entirely separate construct that isn't used for accessibility. I think ACM are onto something with their |
Two years on, I now agree with @dginev: using the correct ARIA attribute is not possible without the author's help – and even then it is not trivial (one has to pick between labelledby, describedby, and details). I think that an empty |
OK, so we have a clear consensus that the best, correct, accessibility requires author (& markup) support. We now can get that with the Over time, authors will start supplying that information. Likely other constructs will also acquire a similar bit of markup enhancement. Likely in the form of a simple chunk of descriptive text, rather than some complicated data structured specifically for aria (at least for non-math). So, we can start thinking about how best to use what we're given. Question 1: Although the LaTeX folks were clearly motivated by HTML's Question 2: What do we do for the currently common case where there is no |
That sounds good to me. We have to be careful though. My understanding is that For when it is pure text, it can be put back in
The problem is that
In this way, captioned images are considered valid in all situations; uncaptioned images with no Some references: |
Tentative improvements towards #1473, #1440 (cc @nxg).
The current use of the figure caption as alt text for images has two problems. One, it is semantically wrong: the caption is visible so it shouldn't be repeated (a screen reader will read it twice!). The other is that it picks the first text node of the caption, so the text may well be truncated.
I modified the schema so that
ltx:caption
gets an ID. Then the image gets an@aria-labelledby
containing that id, instead of trying to copy the caption into the alt text. This seems to be the correct way of doing things, as far as I can tell [1].@alt
is always set to@description
, and so for now it is always empty since there is no mechanism to set it until #1452 is resolved. The treatment of<object>
can be further improved witharia-describedby
, but one thing at a time!Sending this as draft as I haven't tested this in all cases, like with labels, and I have to check with a screen reader. Also, it probably needs to be generalised to all environments with captions (e.g. tables), but I'd prefer to hear some comments before moving forward.
[1] https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-labelledby_attribute