riscv / riscv-isa-manual

RISC-V Instruction Set Manual
https://riscv.org/
Creative Commons Attribution 4.0 International
3.69k stars 643 forks source link

Figures aren't accessible in HTML version #1129

Open ethindp opened 1 year ago

ethindp commented 1 year ago

The HTML version has figures for things like instruction encodings, register layouts, etc., but they appear as just graphics and not in an accessible form (e.g. tables). I don't know if this is a wavedrom issue or not. I can look at the layouts by looking at the wavedrom source, but it's not the most desirable/preferable method.

wmat commented 1 year ago

I'm not sure what you mean by accessible form? The wavedroms are rendered as svg images.

ethindp commented 1 year ago

I mean they aren't rendered as, e.g., a table.

wmat commented 1 year ago

Just so I'm clear, are you asking for the wavedrom content to be rendered as HTML tables? If that's what you're after, what benefit would that provide over a svg? Could you provide a specific example from the spec and what you mean by consuming it?

ethindp commented 1 year ago

@wmat The benefit would be that people with screen readers, like myself, would be able to understand the tables. As it currently stands, the figures just say "graphic diagram" when I arrow over them, which provides no helpful information. Looking at the code, the images are being generated as follows:

<div class="imageblock">
<div class="content">
<img src="data:image/svg+xml;base64,PHN2ZyBjbGFzcz0nV2F2ZURyb20nIGhlaWdodD0nNTYnIHByZXNlcnZlQXNwZWN0UmF0aW89J3hNaWRZTWlkIG1lZXQnIHZpZXdCb3g9JzAgMCA4MDAgNTYnIHdpZHRoPSc4MDAnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PGcgZm9udC1mYW1pbHk9J3NhbnMtc2VyaWYnIGZvbnQtc2l6ZT0nMTQnIGZvbnQtd2VpZ2h0PSdub3JtYWwnIHRleHQtYW5jaG9yPSdtaWRkbGUnIHRyYW5zZm9ybT0ndHJhbnNsYXRlKDAuNSwwLjUpJz48ZyB0cmFuc2Zvcm09J3RyYW5zbGF0ZSg0LDIxKSc+PGcgc3Ryb2tlPSdibGFjaycgc3Ryb2tlLWxpbmVjYXA9J3JvdW5kJyBzdHJva2Utd2lkdGg9JzEnPjxsaW5lIHgyPSc3MTUnLz48bGluZSB5Mj0nMzEnLz48bGluZSB4M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nPjwvZz48L2c+PC9zdmc+" alt="Diagram" width="800" height="56">
</div>
</div>
ethindp commented 1 year ago

An alternative would be to include the SVG directly without base64-encoding it and to instead include accessible SVG attributes.

ethindp commented 1 year ago

You can find more info about accessible SVGs here, but in general a table is better and makes interpreting the data much simpler.

nick-knight commented 1 year ago

I think it's a reasonable request.

One way forward may be to request WaveDrom to provide some kind of conversion tool that "renders" WaveDrom textual descriptions in a format that is friendly to screen readers. The drawback of this approach is that it would require an enhancement to WaveDrom, a third-party tool. However, this tool is maintained by a kind-hearted RISC-V community member, @drom. Even if he doesn't have the bandwidth to implement this feature, I suspect he would welcome a PR.

Another way forward may be to write "alt text" for each WaveDrom graphic. The drawback of this approach is it adds redundancy to every graphic, meaning extra work (and chances for errors) whenever changes are made to them.

ethindp commented 1 year ago

@nick-knight SVGs have accessibility things that WaveDrom could implement as well, including ARIA support. The problem is that to use ARIA properly, one must implement the behaviors that an ARIA role communicates, since ARIA itself does not alter behavior. Of course, as the ARIA authoring guide indicates, no ARIA is better than bad ARIA; in other words, it's better if one simply doesn't need ARIA than one needing to implement it. But the authoring guide for properly using ARIA may be of interest: https://www.w3.org/WAI/ARIA/apg/practices/

ethindp commented 11 months ago

Okay, so I have an update on this. To my surprise, AI's image descriptions (at least chatGPT's) are actually quite useful in hacking around this issue. Obviously, this is not an actual fix to the problem, and an actual fix should definitely be worked upon (e.g. maybe implementing the generation of tables instead of diagrams for bitfields/registers/instruction encodings/whatnot). But it's decent at describing the images, even if they lack context (the image description feature is an add-on to my screen reader, and I'm waiting for an update to allow for context-specific descriptions). It's a decent alternative to having to open the wavedrom files alongside the manual. But hopefully we can get a much higher quality accessibility implementation into wavedrom itself.