This issue has been created
There is 1 update.
 
 
PlantUML Macro / cid:jira-generated-image-avatar-37d3f94a-9d79-40be-942d-fe7686360207 PLANTUML-38 Open

Allow setting the alternative text of the generated diagram

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-5eb8a6fc-a89f-49b5-b34e-eed9a3b7ebeb Charpentier Lucas created this issue on 17/Nov/26 10:26
 
Summary: Allow setting the alternative text of the generated diagram
Issue Type: cid:jira-generated-image-avatar-37d3f94a-9d79-40be-942d-fe7686360207 Improvement
Affects Versions: 2.5
Assignee: Unassigned
Created: 17/Nov/26 10:26
Labels: accessibility
Priority: cid:jira-generated-image-static-major-96c81d80-e510-4ffb-9ab9-38aa33eef61c Major
Reporter: Charpentier Lucas
Description:

Steps to reproduce

  1. Create a page with a PlantUML macro that outputs a PNG, for example:
    {{plantuml}}
    Alice -> Bob : hello
    {{/plantuml}}
    
  2. View the page and inspect the generated image.

Actual result

The image has its own URL as alternative text:

<img src="/xwiki/tmp/plantuml/document%3Axwiki%3ASandbox.WebHome/1932342732.png" alt="/xwiki/tmp/plantuml/document%3Axwiki%3ASandbox.WebHome/1932342732.png"/>

Screen reader users hear an encoded temporary file path instead of what the diagram shows, which fails WCAG 2.2 success criterion 1.1.1 Non-text Content (level A). The macro has no parameter to provide a text alternative: its title parameter is drawn inside the image and never reaches the HTML.

This happens on xwiki.org, for example in the diagram of the accessibility statement.

Expected result

The macro has an alt parameter, whose value becomes the alt attribute of the generated image.

Technical details

DefaultPlantUMLRenderer#renderImageBlock returns new ImageBlock(resourceReference, false) without any parameter, so the XHTML renderer falls back to the image URL for the alt attribute. Passing an alt parameter to the ImageBlock when it is set would fix the PNG output.

Open questions:

  • When alt is not set, should the title parameter be used as a fallback? It is shorter than a full description, but much better than the URL.
  • The SVG output is inlined as raw HTML, so it would need role="img" and an aria-label (or a <title> element) on the <svg> instead of an alt attribute.
 
 

1 update

 
cid:jira-generated-image-avatar-5eb8a6fc-a89f-49b5-b34e-eed9a3b7ebeb Changes by Charpentier Lucas on 17/Nov/26 10:26
 
Fix Version: 2.6