Accessibility (a11y) in diagrams #3689
Replies: 5 comments 3 replies
-
Gleaned from #2732
also from @aardrian in Issue #2732, in a later comment on the example flowchart in the issue:
|
Beta Was this translation helpful? Give feedback.
-
Core Concept: Semantics and ARIA rolesSemantics are the primary way we humans make sense of things. A semantic role manages human expectations about web content, even in cases where sensory cues are arbitrary or unavailable. (If a greeting is called-for, then even a grunt or a wave will serve the purpose). You may know that bumping up the font size in CSS does not make a paragraph into a heading. Yes, it might look like a heading (the larger font is a sensory cue), but semantically it will remain a paragraph. Accessible content should aim to get the semantics -and nesting- right and then there is a good chance that many of the finer-grained details presented visually will make sense by themselves. HTML5 provides implicit semantics for most of its elements, such as headings, lists or nav, and these should certainly be used when available. For other host languages (especially including SVG) then ARIA roles may be used. Explicit ARIA roles vs. implicit semantics from the host language.If the host language provides a semantic implicitly (for example For this reason, in general, role attributes are most likely to appear on generic elements such as
Roles and the Accessibility TreeAssistive tech does not process the DOM directly. Instead, the browser generates an "accessibility tree", which is a subset of the DOM, excluding any 'generic' structures or presentational content. The accessibility tree is as close as we get to an API for assistive technology and roles play a key role in its construction. The nodes of the accessibility tree may be inspected in modern browsers' built-in Developer Tools, where accessible names and ARIA roles and values are typically found. Implementations of the accessibility tree view in the dev tools differ quite a lot by browser. The Firefox one is perhaps the easiest to understand at time of writing. There are some bleeding-edge ways to inspect and manipulate the accessibility tree using javaScript if you are looking for high adventure. Generic, Presentational and hidden content
W3C has documented how specific SVG element types may be included in or excluded from the accessibility tree. Spoiler: In general, they are excluded from the tree by default, and only reliably appear if appropriate ARIA attributes have been added. Roles intended for content "in which the visual appearance or layout of content conveys meaning"For SVG content (such as mermaid charts), there is a vey important implicit semantic ("graphics-document"), but explicit semantic roles (e.g. for individual datapoints) may be provided. Here are the three roles offered by graphics ARIA.
These roles do a decent job of structuring content, but they give very little guidance about what is really meant. It may be valuable to provide further cues about the kind of content in the chart. (e.g. is it a pie chart, or a sequence diagram or something else?) By adding Here is a small example:
Some work is afoot to add appropriate In addition, all the other ARIA roles are available within SVG if necessary.
|
Beta Was this translation helpful? Give feedback.
-
Also adding this comment I made in #2395 : Given the example flowchart, how could we show the possible sequence? Could In a simple example: How should the sequence for a choice and the options be represented? ex: flowchart TD
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
I think that if we can come up with some ideas for aria labels and sequencing (order), I can implement some ideas so we can see how they play out. |
Beta Was this translation helpful? Give feedback.
-
Some news: The ARIA guys have agreed not to deprecate aria-flowto, with the caveat that it is not (yet) fit for purpose. In the long term, a deprecation may occur, but not until we have a viable replacement (which might be a souped-up aria-flowto). I will write more about this soon. |
Beta Was this translation helpful? Give feedback.
-
A very interesting new document was just published. Essential reading for all working in the accessible chart space. |
Beta Was this translation helpful? Give feedback.
-
There has been some great discussion and information about accessibility (a11y) in mermaid diagrams (flowcharts, specifically) in issue # 2395 . I'm starting this discussion to uncover the ideas and discussion.
Here are some of the ideas and questions raised. This is not exhaustive -- it's just a rough start.
What are links and references that will help explain the issues and potential solutions?
I'm willing to put together examples (I'll create branches and try to implement ideas, then put the resulting SVG images in this discussion).
Beta Was this translation helpful? Give feedback.
All reactions