collab/mermaid/docs/config/accessibility.mdblame
View source
6dd74de1> **Warning**
6dd74de2>
6dd74de3> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
6dd74de4>
6dd74de5> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/accessibility.md](../../packages/mermaid/src/docs/config/accessibility.md).
6dd74de6
6dd74de7# Accessibility Options
6dd74de8
6dd74de9## Accessibility
6dd74de10
6dd74de11Now with Mermaid library in much wider use, we have started to work towards more accessible features, based on the feedback from the community.
6dd74de12
6dd74de13Adding accessibility means that the rich information communicated by visual diagrams can be made available to those using assistive technologies (and of course to search engines).
6dd74de14[Read more about Accessible Rich Internet Applications and the W3 standards.](https://www.w3.org/WAI/standards-guidelines/aria/)
6dd74de15
6dd74de16Mermaid will automatically insert the [aria-roledescription](#aria-roledescription) and, if provided in the diagram text by the diagram author, the [accessible title and description.](#accessible-title-and-description)
6dd74de17
6dd74de18### aria-roledescription
6dd74de19
6dd74de20The [aria-roledescription](https://www.w3.org/TR/wai-aria-1.1/#aria-roledescription) for the SVG HTML element is set to the diagram type key. (Note this may be slightly different than the keyword used for the diagram in the diagram text.)
6dd74de21
6dd74de22For example: The diagram type key for a state diagram is "stateDiagram". Here (a part of) the HTML of the SVG tag that shows the automatically inserted aria-roledescription set to "stateDiagram". _(Note that some of the SVG attributes and the SVG contents are omitted for clarity.):_
6dd74de23
6dd74de24```html
6dd74de25<svg
6dd74de26 aria-roledescription="stateDiagram"
6dd74de27 class="statediagram"
6dd74de28 xmlns="http://www.w3.org/2000/svg"
6dd74de29 width="100%"
6dd74de30 id="mermaid-1668720491568"
6dd74de31></svg>
6dd74de32```
6dd74de33
6dd74de34### Accessible Title and Description
6dd74de35
6dd74de36Support for accessible titles and descriptions is available for all diagrams/chart types. We have tried to keep the same keywords and format for all diagrams so that it is easy to understand and maintain.
6dd74de37
6dd74de38The accessible title and description will add `<title>` and `<desc>` elements within the SVG element and the [aria-labelledby](https://www.w3.org/TR/wai-aria/#aria-labelledby) and [aria-describedby](https://www.w3.org/TR/wai-aria/#aria-describedby) attributes in the SVG tag.
6dd74de39
6dd74de40Here is HTML that is generated, showing that the SVG element is labelled by the accessible title (id = `chart-title-mermaid-1668725057758`)
6dd74de41and described by the accessible description (id = `chart-desc-mermaid-1668725057758` );
6dd74de42and the accessible title element (text = "This is the accessible title")
6dd74de43and the accessible description element (text = "This is an accessible description").
6dd74de44
6dd74de45_(Note that some of the SVG attributes and the SVG contents are omitted for clarity.)_
6dd74de46
6dd74de47```html
6dd74de48<svg
6dd74de49 aria-labelledby="chart-title-mermaid-1668725057758"
6dd74de50 aria-describedby="chart-desc-mermaid-1668725057758"
6dd74de51 xmlns="http://www.w3.org/2000/svg"
6dd74de52 width="100%"
6dd74de53 id="mermaid-1668725057758"
6dd74de54>
6dd74de55 <title id="chart-title-mermaid-1668725057758">This is the accessible title</title>
6dd74de56 <desc id="chart-desc-mermaid-1668725057758">This is an accessible description</desc>
6dd74de57</svg>
6dd74de58```
6dd74de59
6dd74de60Details for the syntax follow.
6dd74de61
6dd74de62#### accessible title
6dd74de63
6dd74de64The **accessible title** is specified with the **accTitle** _keyword_, followed by a colon (`:`), and the string value for the title.
6dd74de65The string value ends at the end of the line. (It can only be a single line.)
6dd74de66
6dd74de67Ex: `accTitle: This is a single line title`
6dd74de68
6dd74de69See [the accTitle and accDescr usage examples](#acctitle-and-accdescr-usage-examples) for how this can be used in a diagram and the resulting HTML generated.
6dd74de70
6dd74de71#### accessible description
6dd74de72
6dd74de73An accessible description can be 1 line long (a single line) or many lines long.
6dd74de74
6dd74de75The **single line accessible description** is specified with the **accDescr** _keyword_, followed by a colon (`:`), followed by the string value for the description.
6dd74de76
6dd74de77Ex: `accDescr: This is a single line description.`
6dd74de78
6dd74de79A **multiple line accessible description** _does not have a colon (`:`) after the accDescr keyword_ and is surrounded by curly brackets (`{}`).
6dd74de80
6dd74de81Ex:
6dd74de82
6dd74de83```markdown
6dd74de84accDescr {
6dd74de85This is a multiple line accessible description.
6dd74de86It does not have a colon and is surrounded by curly brackets.
6dd74de87}
6dd74de88```
6dd74de89
6dd74de90See [the accTitle and accDescr usage examples](#acctitle-and-accdescr-usage-examples) for how this can be used in a diagram and the resulting HTML generated.
6dd74de91
6dd74de92#### accTitle and accDescr Usage Examples
6dd74de93
6dd74de94- Flowchart with the accessible title "Big Decisions" and the single-line accessible description "Bob's Burgers process for making big decisions"
6dd74de95
6dd74de96```mermaid-example
6dd74de97 graph LR
6dd74de98 accTitle: Big Decisions
6dd74de99 accDescr: Bob's Burgers process for making big decisions
6dd74de100 A[Identify Big Decision] --> B{Make Big Decision}
6dd74de101 B --> D[Be done]
6dd74de102```
6dd74de103
6dd74de104```mermaid
6dd74de105 graph LR
6dd74de106 accTitle: Big Decisions
6dd74de107 accDescr: Bob's Burgers process for making big decisions
6dd74de108 A[Identify Big Decision] --> B{Make Big Decision}
6dd74de109 B --> D[Be done]
6dd74de110```
6dd74de111
6dd74de112Here is the HTML generated for the SVG element: _(Note that some of the SVG attributes and the SVG contents are omitted for clarity.):_
6dd74de113
6dd74de114```html
6dd74de115<svg
6dd74de116 aria-labelledby="chart-title-mermaid_382ee221"
6dd74de117 aria-describedby="chart-desc-mermaid_382ee221"
6dd74de118 aria-roledescription="flowchart-v2"
6dd74de119 xmlns="http://www.w3.org/2000/svg"
6dd74de120 width="100%"
6dd74de121 id="mermaid_382ee221"
6dd74de122>
6dd74de123 <title id="chart-title-mermaid_382ee221">Big decisions</title>
6dd74de124 <desc id="chart-desc-mermaid_382ee221">Bob's Burgers process for making big decisions</desc>
6dd74de125</svg>
6dd74de126```
6dd74de127
6dd74de128- Flowchart with the accessible title "Bob's Burger's Making Big Decisions" and the multiple line accessible description "The official Bob's Burgers corporate processes that are used
6dd74de129 for making very, very big decisions.
6dd74de130 This is actually a very simple flow: identify the big decision and then make the big decision."
6dd74de131
6dd74de132```mermaid-example
6dd74de133 graph LR
6dd74de134 accTitle: Bob's Burger's Making Big Decisions
6dd74de135 accDescr {
6dd74de136 The official Bob's Burgers corporate processes that are used
6dd74de137 for making very, very big decisions.
6dd74de138 This is actually a very simple flow: identify the big decision and then make the big decision.
6dd74de139 }
6dd74de140 A[Identify Big Decision] --> B{Make Big Decision}
6dd74de141 B --> D[Be done]
6dd74de142```
6dd74de143
6dd74de144```mermaid
6dd74de145 graph LR
6dd74de146 accTitle: Bob's Burger's Making Big Decisions
6dd74de147 accDescr {
6dd74de148 The official Bob's Burgers corporate processes that are used
6dd74de149 for making very, very big decisions.
6dd74de150 This is actually a very simple flow: identify the big decision and then make the big decision.
6dd74de151 }
6dd74de152 A[Identify Big Decision] --> B{Make Big Decision}
6dd74de153 B --> D[Be done]
6dd74de154```
6dd74de155
6dd74de156Here is the HTML generated for the SVG element: _(Note that some of the SVG attributes and the SVG contents are omitted for clarity.):_
6dd74de157
6dd74de158```html
6dd74de159<svg
6dd74de160 aria-labelledby="chart-title-mermaid_382ee221"
6dd74de161 aria-describedby="chart-desc-mermaid_382ee221"
6dd74de162 aria-roledescription="flowchart-v2"
6dd74de163 xmlns="http://www.w3.org/2000/svg"
6dd74de164 width="100%"
6dd74de165 id="mermaid_382ee221"
6dd74de166>
6dd74de167 <title id="chart-title-mermaid_382ee221">Big decisions</title>
6dd74de168 <desc id="chart-desc-mermaid_382ee221">
6dd74de169 The official Bob's Burgers corporate processes that are used for making very, very big
6dd74de170 decisions. This is actually a very simple flow: identify the big decision and then make the big
6dd74de171 decision.
6dd74de172 </desc>
6dd74de173</svg>
6dd74de174```
6dd74de175
6dd74de176#### Sample Code Snippets for other diagram types
6dd74de177
6dd74de178##### Class Diagram
6dd74de179
6dd74de180```mermaid-example
6dd74de181 classDiagram
6dd74de182 accTitle: My Class Diagram
6dd74de183 accDescr: My Class Diagram Description
6dd74de184
6dd74de185 Vehicle <|-- Car
6dd74de186```
6dd74de187
6dd74de188```mermaid
6dd74de189 classDiagram
6dd74de190 accTitle: My Class Diagram
6dd74de191 accDescr: My Class Diagram Description
6dd74de192
6dd74de193 Vehicle <|-- Car
6dd74de194```
6dd74de195
6dd74de196##### Entity Relationship Diagram
6dd74de197
6dd74de198```mermaid-example
6dd74de199 erDiagram
6dd74de200 accTitle: My Entity Relationship Diagram
6dd74de201 accDescr: My Entity Relationship Diagram Description
6dd74de202
6dd74de203 CUSTOMER ||--o{ ORDER : places
6dd74de204 ORDER ||--|{ LINE-ITEM : contains
6dd74de205 CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
6dd74de206
6dd74de207```
6dd74de208
6dd74de209```mermaid
6dd74de210 erDiagram
6dd74de211 accTitle: My Entity Relationship Diagram
6dd74de212 accDescr: My Entity Relationship Diagram Description
6dd74de213
6dd74de214 CUSTOMER ||--o{ ORDER : places
6dd74de215 ORDER ||--|{ LINE-ITEM : contains
6dd74de216 CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
6dd74de217
6dd74de218```
6dd74de219
6dd74de220##### Gantt Chart
6dd74de221
6dd74de222```mermaid-example
6dd74de223 gantt
6dd74de224 accTitle: My Gantt Chart Accessibility Title
6dd74de225 accDescr: My Gantt Chart Accessibility Description
6dd74de226
6dd74de227 title A Gantt Diagram
6dd74de228 dateFormat YYYY-MM-DD
6dd74de229 section Section
6dd74de230 A task :a1, 2014-01-01, 30d
6dd74de231 Another task :after a1 , 20d
6dd74de232 section Another
6dd74de233 Task in sec :2014-01-12 , 12d
6dd74de234 another task : 24d
6dd74de235
6dd74de236```
6dd74de237
6dd74de238```mermaid
6dd74de239 gantt
6dd74de240 accTitle: My Gantt Chart Accessibility Title
6dd74de241 accDescr: My Gantt Chart Accessibility Description
6dd74de242
6dd74de243 title A Gantt Diagram
6dd74de244 dateFormat YYYY-MM-DD
6dd74de245 section Section
6dd74de246 A task :a1, 2014-01-01, 30d
6dd74de247 Another task :after a1 , 20d
6dd74de248 section Another
6dd74de249 Task in sec :2014-01-12 , 12d
6dd74de250 another task : 24d
6dd74de251
6dd74de252```
6dd74de253
6dd74de254##### GitGraph
6dd74de255
6dd74de256```mermaid-example
6dd74de257 gitGraph
6dd74de258 accTitle: My GitGraph Accessibility Title
6dd74de259 accDescr: My GitGraph Accessibility Description
6dd74de260
6dd74de261 commit
6dd74de262 commit
6dd74de263 branch develop
6dd74de264 checkout develop
6dd74de265 commit
6dd74de266 commit
6dd74de267 checkout main
6dd74de268 merge develop
6dd74de269 commit
6dd74de270 commit
6dd74de271
6dd74de272```
6dd74de273
6dd74de274```mermaid
6dd74de275 gitGraph
6dd74de276 accTitle: My GitGraph Accessibility Title
6dd74de277 accDescr: My GitGraph Accessibility Description
6dd74de278
6dd74de279 commit
6dd74de280 commit
6dd74de281 branch develop
6dd74de282 checkout develop
6dd74de283 commit
6dd74de284 commit
6dd74de285 checkout main
6dd74de286 merge develop
6dd74de287 commit
6dd74de288 commit
6dd74de289
6dd74de290```
6dd74de291
6dd74de292##### Pie Chart
6dd74de293
6dd74de294```mermaid-example
6dd74de295 pie
6dd74de296 accTitle: My Pie Chart Accessibility Title
6dd74de297 accDescr: My Pie Chart Accessibility Description
6dd74de298
6dd74de299 title Key elements in Product X
6dd74de300 "Calcium" : 42.96
6dd74de301 "Potassium" : 50.05
6dd74de302 "Magnesium" : 10.01
6dd74de303 "Iron" : 5
6dd74de304
6dd74de305```
6dd74de306
6dd74de307```mermaid
6dd74de308 pie
6dd74de309 accTitle: My Pie Chart Accessibility Title
6dd74de310 accDescr: My Pie Chart Accessibility Description
6dd74de311
6dd74de312 title Key elements in Product X
6dd74de313 "Calcium" : 42.96
6dd74de314 "Potassium" : 50.05
6dd74de315 "Magnesium" : 10.01
6dd74de316 "Iron" : 5
6dd74de317
6dd74de318```
6dd74de319
6dd74de320##### Requirement Diagram
6dd74de321
6dd74de322```mermaid-example
6dd74de323 requirementDiagram
6dd74de324 accTitle: My Requirement Diagram
6dd74de325 accDescr: My Requirement Diagram Description
6dd74de326
6dd74de327 requirement test_req {
6dd74de328 id: 1
6dd74de329 text: the test text.
6dd74de330 risk: high
6dd74de331 verifymethod: test
6dd74de332 }
6dd74de333
6dd74de334 element test_entity {
6dd74de335 type: simulation
6dd74de336 }
6dd74de337
6dd74de338 test_entity - satisfies -> test_req
6dd74de339
6dd74de340```
6dd74de341
6dd74de342```mermaid
6dd74de343 requirementDiagram
6dd74de344 accTitle: My Requirement Diagram
6dd74de345 accDescr: My Requirement Diagram Description
6dd74de346
6dd74de347 requirement test_req {
6dd74de348 id: 1
6dd74de349 text: the test text.
6dd74de350 risk: high
6dd74de351 verifymethod: test
6dd74de352 }
6dd74de353
6dd74de354 element test_entity {
6dd74de355 type: simulation
6dd74de356 }
6dd74de357
6dd74de358 test_entity - satisfies -> test_req
6dd74de359
6dd74de360```
6dd74de361
6dd74de362##### Sequence Diagram
6dd74de363
6dd74de364```mermaid-example
6dd74de365 sequenceDiagram
6dd74de366 accTitle: My Sequence Diagram
6dd74de367 accDescr: My Sequence Diagram Description
6dd74de368
6dd74de369 Alice->>John: Hello John, how are you?
6dd74de370 John-->>Alice: Great!
6dd74de371 Alice-)John: See you later!
6dd74de372```
6dd74de373
6dd74de374```mermaid
6dd74de375 sequenceDiagram
6dd74de376 accTitle: My Sequence Diagram
6dd74de377 accDescr: My Sequence Diagram Description
6dd74de378
6dd74de379 Alice->>John: Hello John, how are you?
6dd74de380 John-->>Alice: Great!
6dd74de381 Alice-)John: See you later!
6dd74de382```
6dd74de383
6dd74de384##### State Diagram
6dd74de385
6dd74de386```mermaid-example
6dd74de387 stateDiagram
6dd74de388 accTitle: My State Diagram
6dd74de389 accDescr: My State Diagram Description
6dd74de390
6dd74de391 s1 --> s2
6dd74de392
6dd74de393```
6dd74de394
6dd74de395```mermaid
6dd74de396 stateDiagram
6dd74de397 accTitle: My State Diagram
6dd74de398 accDescr: My State Diagram Description
6dd74de399
6dd74de400 s1 --> s2
6dd74de401
6dd74de402```
6dd74de403
6dd74de404##### User Journey Diagram
6dd74de405
6dd74de406```mermaid-example
6dd74de407 journey
6dd74de408 accTitle: My User Journey Diagram
6dd74de409 accDescr: My User Journey Diagram Description
6dd74de410
6dd74de411 title My working day
6dd74de412 section Go to work
6dd74de413 Make tea: 5: Me
6dd74de414 Go upstairs: 3: Me
6dd74de415 Do work: 1: Me, Cat
6dd74de416 section Go home
6dd74de417 Go downstairs: 5: Me
6dd74de418 Sit down: 5: Me
6dd74de419
6dd74de420```
6dd74de421
6dd74de422```mermaid
6dd74de423 journey
6dd74de424 accTitle: My User Journey Diagram
6dd74de425 accDescr: My User Journey Diagram Description
6dd74de426
6dd74de427 title My working day
6dd74de428 section Go to work
6dd74de429 Make tea: 5: Me
6dd74de430 Go upstairs: 3: Me
6dd74de431 Do work: 1: Me, Cat
6dd74de432 section Go home
6dd74de433 Go downstairs: 5: Me
6dd74de434 Sit down: 5: Me
6dd74de435
6dd74de436```