{"id":771,"date":"2022-08-25T16:08:16","date_gmt":"2022-08-25T16:08:16","guid":{"rendered":"https:\/\/html5accessibility.com\/stuff\/?p=771"},"modified":"2022-08-25T16:08:16","modified_gmt":"2022-08-25T16:08:16","slug":"short-note-on-figure-and-figcaption","status":"publish","type":"post","link":"https:\/\/html5accessibility.com\/stuff\/2022\/08\/25\/short-note-on-figure-and-figcaption\/","title":{"rendered":"short note on figure and figcaption"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-778 size-full\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/jonny2.jpg\" alt=\"A person watching Jonny James presenting, while riding an exercise bike. Jonny performs in front of a giant effigy of Billy Gregory during his Lumberjack stage. The text on the slide asks 'So when did I first hear about accessibility?'\" width=\"562\" height=\"464\" srcset=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/jonny2.jpg 562w, https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/jonny2-300x248.jpg 300w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/><\/p>\n<p>In 2011 when <a href=\"https:\/\/www.tpgi.com\/html5-accessibility-chops-the-figure-and-figcaption-elements\">I first started thinking about<\/a> how best to map the semantics of <code>figure\/figcaption<\/code> to accessibility API properties, the set of <a href=\"https:\/\/www.w3.org\/TR\/wai-aria-1.0\/\">properties to choose from<\/a> was limited as <a href=\"https:\/\/w3c.github.io\/aria\/\">compared to 2022<\/a>.<\/p>\n<p>What ended up being implemented in browsers was a naming relationship between the <code>figure<\/code> element and the <code>figcaption<\/code> element. The accessible name for the <code>figure<\/code> element is provided by the content of the <code>figcaption<\/code> element.<\/p>\n<h3>Code example<\/h3>\n<p>Using ARIA to illustrate the information exposed natively in the Accessibility Tree for the <em>labelledby<\/em> <code>figure\/figcaption<\/code> accessibility mapping.<\/p>\n<pre>&lt;figure <mark>role=\"figure\"<\/mark> <mark>aria-labelledby=\"figcaption\"<\/mark>&gt;\r\n&lt;img src=\"exercise.jpg\" alt=\"Watching Jonny James\r\npresenting, while riding an exercise bike\"&gt;\r\n&lt;figcaption <mark>role=\"caption\"<\/mark> <mark>id=\"figcaption\"<\/mark>&gt;\r\nThe Lasertour Perceptronics allows you to \r\nexercise your mind while <em>working<\/em> your body\r\n&lt;\/figcaption&gt;\r\n&lt;\/figure&gt;<\/pre>\n<h3>Typical expected Aural output<\/h3>\n<pre><strong>figure <\/strong><em>The Lasertour Perceptronics allows \r\nyou to exercise your mind <\/em><em>while working your body.<\/em>\r\n<strong>graphic<\/strong> <em>Watching Jonny James presenting<\/em>\r\n<em>while riding an exercise bike.<\/em>\r\n<strong>caption<\/strong>\r\n<em>The Lasertour Perceptronics allows you to \r\nexercise your mind <\/em><em>while working your body.<\/em>\r\n<strong>out of figure<\/strong><\/pre>\n<p class=\"note\">The <code>figure<\/code> and <code>caption<\/code> role are announced. The <code>figcaption<\/code> element content is announced twice, First as the accessible name for the <code>figure<\/code> element. Secondly as the user cursors through the <code>figcaption<\/code> content. The repetition itself is not a showstopper in the example, but as it has been found that sometimes in the wild <code>figcaption<\/code> text can consist of multiple paragraphs of text, its use as an accessible name becomes <em>unwieldy<\/em> and the repetition becomes <strong>obstructive<\/strong>.<\/p>\n<h2>Changes<\/h2>\n<p>Recently there has been <a href=\"https:\/\/github.com\/w3c\/html-aam\/pull\/359\">a proposed change in the mapping<\/a>. The <em>labelledby<\/em> relationship is no longer, instead there are\u00a0 <code>details\/detailsfor<\/code> relationships, the <code>figure<\/code> element has a <code>details<\/code> relationship referencing the <code>figcaption<\/code> element and the <code>figcaption<\/code> has a reverse <code>detailsFor<\/code> relationship referencing the parent <code>figure<\/code> All this is provided automatically by the browser, you don&#8217;t have to do anything.<\/p>\n<p>The advantages of this accessibility mapping are that the user will not hear the caption multiple times and the <code>figure<\/code> element is identified as having details and the <code>figcaption<\/code> is identified as the details for the <code>figure<\/code>.<\/p>\n<p class=\"note\"><code>details\/detailsFor<\/code> relationships are already implemented in Chrome as of now (and other browsers which use the Blink engine).<\/p>\n<p class=\"note\">These <a href=\"https:\/\/wiki.linuxfoundation.org\/accessibility\/iaccessible2\/start\">Iaccessible2 API<\/a> relationships are not well exposed in most in browser accessibility tools. I use <a href=\"https:\/\/github.com\/IBMa\/AccProbe\">accProbe<\/a> to view them:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-795 size-full\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/details1a2-1-e1661358318576.png\" alt=\"details relationship represented in the AccProbe UI\" width=\"711\" height=\"71\" srcset=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/details1a2-1-e1661358318576.png 711w, https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/details1a2-1-e1661358318576-300x30.png 300w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-793 size-full\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/detailsfor.png\" alt=\"detailsFor relationship represented in the AccProbe UI\" width=\"699\" height=\"71\" srcset=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/detailsfor.png 699w, https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2022\/08\/detailsfor-300x30.png 300w\" sizes=\"auto, (max-width: 699px) 100vw, 699px\" \/><\/p>\n<h3>Code example<\/h3>\n<p>Using ARIA to illustrate the information exposed natively in the Accessibility Tree for the <em>details<\/em> <code>figure\/figcaption<\/code> accessibility mapping.<\/p>\n<pre>&lt;figure <mark>role=\"figure\"<\/mark> <mark>aria-details=\"figcaption\"<\/mark>&gt;\r\n&lt;img src=\"exercise.jpg\" alt=\"Watching Jonny James\r\npresenting, while riding an exercise bike\"&gt;\r\n&lt;figcaption <mark>role=\"caption\"<\/mark> <mark>id=\"figcaption\"<\/mark>&gt;\r\nThe Lasertour Perceptronics allows you to \r\nexercise your mind while <em>working<\/em> your body\r\n&lt;\/figcaption&gt;\r\n&lt;\/figure&gt;<\/pre>\n<h3>Typical expected Aural output<\/h3>\n<pre><strong>figure, has details<\/strong>\r\n<strong>graphic<\/strong> <em>Watching Jonny James presenting<\/em>\r\n<em>while riding an exercise bike.<\/em>\r\n<strong>caption, entering details<\/strong>\r\n<em>The Lasertour Perceptronics allows you to \r\nexercise your mind <\/em><em>while working your body.<\/em>\r\n<strong>out of figure<\/strong><\/pre>\n<h2>Current output<\/h2>\n<p>As mentioned the <code>details<\/code> relationship is only implemented in chrome as of now, but its effect can be experienced in other browsers by using the <a href=\"https:\/\/w3c.github.io\/aria\/#aria-details\"><code>aria-details<\/code><\/a> attribute.<\/p>\n<h3>try it yourself<\/h3>\n<p class=\"codepen\" style=\"height: 600px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-height=\"600\" data-default-tab=\"result\" data-slug-hash=\"JjLvbEN\" data-user=\"stevef\">See the Pen <a href=\"https:\/\/codepen.io\/stevef\/pen\/JjLvbEN\"><br \/>\nfigure\/figcaption test<\/a> by steve faulkner (<a href=\"https:\/\/codepen.io\/stevef\">@stevef<\/a>)<br \/>\non <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/cpwebassets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<h3>Too many details in JAWS<\/h3>\n<p>Currently in JAWS, when a <code>figure<\/code> is navigated through, each of the child elements is announced as having &#8220;has details&#8221; including the <code>figcaption<\/code> element. This is a <strong>bug<\/strong>. It can range from being somewhat annoying to <strong>really<\/strong> annoying, depending on what is contained in the figure:<\/p>\n<ol>\n<li>When the <a href=\"https:\/\/cdpn.io\/pen\/debug\/JjLvbEN\">figure contains only an image<\/a>; somewhat annoying<\/li>\n<li>When the <a href=\"https:\/\/cdpn.io\/pen\/debug\/zYWmPYY\">figure contains a list<\/a>; annoying to <em>very annoying<\/em><\/li>\n<li>When the <a href=\"https:\/\/cdpn.io\/pen\/debug\/KKoGggM\">figure contains a data table<\/a>; <strong>very<\/strong> <strong>VERY<\/strong> <strong>annoying!<\/strong><\/li>\n<\/ol>\n<p>The bug was brought to my attention by my good friend <a href=\"https:\/\/twitter.com\/LeonieWatson\">L\u00e9onie Watson<\/a> who found the errant announcements to be extremely annoying, getting in the way of her understanding the content with figures, hence my investigation of the issue.<\/p>\n<h4>What is a developer to do?<\/h4>\n<p>I strongly suggest that developers do nothing to work around this bug in JAWS. I talked to my friend and Freedom Scientific colleague <a href=\"https:\/\/www.afb.org\/aw\/7\/2\/14519\">Glen Gordon<\/a> about the bug and he assured me that a fix was being worked on, and an updated version of JAWS will be available soon.<\/p>\n<hr \/>\n<h2 class=\"note\">David and Jonny at a11yTO<\/h2>\n<p>My friends and colleagues <a href=\"https:\/\/twitter.com\/DavidOfYork\">Dr David Swallow<\/a> and <a href=\"https:\/\/twitter.com\/heresjonnyjames\">Jonny James<\/a> are presenting at <a href=\"https:\/\/conf.a11yto.com\/\">a11yTO Conf<\/a>, October 2022 in Toronto. You won&#8217;t want to miss either of them or the <a href=\"https:\/\/conf.a11yto.com\/talks\">many other fantastic speakers<\/a> at a11yTO Conf 2022. <a href=\"https:\/\/tickets.a11yto.com\/e\/5\">Early Bird tickets<\/a> are on sale NOW (until September 5th)<br \/>\n<strong>A flavour of what you could possibly experience from David and Jonny<\/strong><br \/>\n<iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/ZWHhPfIKgvE\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In 2011 when I first started thinking about how best to map the semantics of figure\/figcaption to accessibility API properties, the set of properties to choose from was limited as compared to 2022. What ended up being implemented in browsers was a naming relationship between the figure element and the figcaption element. The accessible name [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-771","post","type-post","status-publish","format-standard","hentry","category-htmlaccessibility"],"_links":{"self":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/comments?post=771"}],"version-history":[{"count":38,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/771\/revisions"}],"predecessor-version":[{"id":815,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/771\/revisions\/815"}],"wp:attachment":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/media?parent=771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/categories?post=771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/tags?post=771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}