{"id":416,"date":"2021-05-31T14:43:01","date_gmt":"2021-05-31T14:43:01","guid":{"rendered":"https:\/\/html5accessibility.com\/stuff\/?p=416"},"modified":"2021-05-31T17:29:32","modified_gmt":"2021-05-31T17:29:32","slug":"the-hidden-world-of-aria-hidden","status":"publish","type":"post","link":"https:\/\/html5accessibility.com\/stuff\/2021\/05\/31\/the-hidden-world-of-aria-hidden\/","title":{"rendered":"The hidden world of aria-hidden"},"content":{"rendered":"<figure id=\"attachment_398\" aria-describedby=\"caption-attachment-398\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-398\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/Capture-1.jpg\" alt=\"David's head of a suited man sitting, holding a keyboard, with a very old looking PC - a frame from a 1980's tv technology show.\" width=\"600\" height=\"384\" srcset=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/Capture-1.jpg 755w, https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/Capture-1-300x192.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-398\" class=\"wp-caption-text\">Dr Swallow returns, and it is fair to say, despite a dose of bath salts, he is not pleased with aria-hidden<\/figcaption><\/figure>\n<h2>hides in the light<\/h2>\n<p>An interesting feature of <code>aria-hidden<\/code> is that it hides stuff from screen reader users, but its effects are hidden from everyone else. Unless you going looking for it and understand what it does, you will have no idea how powerful it is and what a detrimental effect it can have if used unwisely, without understanding.<\/p>\n<p>This is further complicated by interoperability issues. The effects of aria-hidden are not consistent across browsers and screen readers.<\/p>\n<p>Take the following quote:<\/p>\n<blockquote aria-hidden=\"true\"><p>Text available to all except screen readers.<\/p><\/blockquote>\n<h3>code:<\/h3>\n<pre>&lt;blockquote <mark>aria-hidden=\"true\"<\/mark>&gt;\r\nText available to all except screen readers.\r\n&lt;\/blockquote&gt;<\/pre>\n<h2>So far so good<\/h2>\n<p>When the descendants of an element <code>aria-hidden=true<\/code> are <strong>non focusable<\/strong> they are <em>chopped<\/em> out of the <a href=\"https:\/\/www.tpgi.com\/the-browser-accessibility-tree\/\">accessibility tree<\/a> in both Chrome and Firefox.<\/p>\n<figure id=\"attachment_420\" aria-describedby=\"caption-attachment-420\" style=\"width: 350px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-420\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/hidden-firefox.gif\" alt=\"blockquote is not in the accessibility tree\" width=\"350\" height=\"94\" \/><figcaption id=\"caption-attachment-420\" class=\"wp-caption-text\">Firefox accessibility tree does not include the <code>blockquote<\/code><\/figcaption><\/figure>\n<figure id=\"attachment_419\" aria-describedby=\"caption-attachment-419\" style=\"width: 350px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-419\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/hidden-chrome.gif\" alt=\"blockquote is not in the accessibility tree\" width=\"350\" height=\"109\" \/><figcaption id=\"caption-attachment-419\" class=\"wp-caption-text\">Chrome accessibility tree does not include the <code>blockquote<\/code><\/figcaption><\/figure>\n<p>What happens when interactive elements are added to the mix?<\/p>\n<h2>Browser bifurcation time<\/h2>\n<p>Take the following quote:<\/p>\n<blockquote aria-hidden=\"true\"><p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Folie_%C3%A0_Deux_(The_X-Files)\"><span lang=\"fr\">Folie \u00e0 Deux<\/span><\/a> (The <span tabindex=\"-1\">X-Files<\/span>)<\/p>\n<p><input alt=\"hides in the light\" src=\"https:\/\/assets.codepen.io\/128034\/hides.jpg\" type=\"image\" width=\"500\" \/><\/p>\n<p tabindex=\"0\"><span lang=\"fr\">Folie \u00e0 Deux<\/span>, a form of insanity shared by two people. It usually begins with one person who conceives of a delusional belief and then spreads it to another; thus, those two share the same delusion.<\/p>\n<\/blockquote>\n<h3 tabindex=\"0\">Code:<\/h3>\n<pre tabindex=\"0\">&lt;blockquote <mark>aria-hidden=\"true\"<\/mark>&gt;\r\n&lt;p&gt;\r\n<mark>&lt;a href=\"...\"&gt;<\/mark>\r\n&lt;span lang=\"fr\"&gt;Folie \u00e0 Deux&lt;\/span&gt;&lt;\/a&gt; \r\n(The &lt;span <mark>tabindex=\"-1\"<\/mark>&gt;X-Files&lt;\/span&gt;)&lt;\/p&gt;\r\n<mark>&lt;input type=\"image\" src=\"hides.jpg\" \r\nalt=\"hides in the light\" \r\nonclick=\"skinner();\"&gt;<\/mark>\r\n&lt;p <mark>tabindex=\"0\"<\/mark>&gt;\r\n&lt;span lang=\"fr\"&gt;Folie \u00e0 Deux&lt;\/span&gt;, \r\na form of insanity shared by two people. \r\nIt usually begins with one person who \r\nconceives of a delusional belief and \r\nthen spreads it to another; thus, \r\nthose two share the same delusion.&lt;\/p&gt;\r\n&lt;\/blockquote&gt;<\/pre>\n<h2>Splitsville<\/h2>\n<p>While Firefox still chops the blockquote and its descendants out of the accessibility tree:<\/p>\n<figure id=\"attachment_420\" aria-describedby=\"caption-attachment-420\" style=\"width: 350px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-420\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/hidden-firefox2.gif\" alt=\"blockquote is not in the accessibility tree\" width=\"350\" height=\"94\" \/><figcaption id=\"caption-attachment-420\" class=\"wp-caption-text\">Firefox accessibility tree does not include the <code>blockquote<\/code><\/figcaption><\/figure>\n<p>Chrome exposes <a href=\"https:\/\/html.spec.whatwg.org\/multipage\/dom.html#interactive-content-2\">interactive elements<\/a> <em>and<\/em> elements with a <code>tabindex<\/code>, which are exposed with states of <code>focusable, invisible<\/code>, and it appears that Safari on Mac does the same.<\/p>\n<pre><del>&lt;blockquote aria-hidden=\"true\"&gt; &lt;p&gt;<\/del>\r\n<strong>&lt;a href=\"...\"&gt;<\/strong>&lt;span lang=\"fr\"&gt;Folie \u00e0 Deux&lt;\/span&gt;<strong>&lt;\/a&gt;<\/strong>\r\n<del>(<\/del> <strong>&lt;span tabindex=\"-1\"&gt;X-Files&lt;\/span&gt; <\/strong><del>)&lt;\/p&gt;<\/del>\r\n<strong>&lt;input type=\"image\" src=\"hides.jpg\" alt=\"hides in the light\" \r\nonclick=\"skinner();\"&gt;<\/strong>\r\n<strong>&lt;p tabindex=\"0\"&gt; &lt;span lang=\"fr\"&gt;Folie \u00e0 Deux&lt;\/span&gt;, \r\na form of insanity shared by two people. It usually \r\nbegins with one person who conceives of a delusional \r\nbelief and then spreads it to another; thus, those \r\ntwo share the same delusion.&lt;\/p&gt;<\/strong>\r\n<del>&lt;\/blockquote&gt;\r\n<\/del><\/pre>\n<figure id=\"attachment_429\" aria-describedby=\"caption-attachment-429\" style=\"width: 352px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-429 size-full\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/hidden-chrome2-1.gif\" alt=\"\" width=\"352\" height=\"101\" \/><figcaption id=\"caption-attachment-429\" class=\"wp-caption-text\">Chrome does not include the <code>blockquote<\/code>, but it does include the focusable descendants of the <code>blockquote<\/code><\/figcaption><\/figure>\n<h2>Special affects<\/h2>\n<p>When interactive elements are descendants of an element with <code>aria-hidden=\"true\"<\/code> (or have it set on the element itself) in Firefox it&#8217;s not included in the accessibility tree, <strong>but is still focusable<\/strong>, and not announced by Screen Readers such as NVDA and Narrator in Chrome.\u00a0 This is why I made up the:<\/p>\n<blockquote>\n<p id=\"fourth\" tabindex=\"-1\"><a href=\"https:\/\/w3c.github.io\/using-aria\/#fourth\"><strong>4th Rule of <abbr title=\"Accessible Rich Internet Applications\">ARIA<\/abbr> Use<\/strong><\/a><\/p>\n<p>Do not use <code>role=\"presentation\"<\/code> or <code>aria-hidden=\"true\"<\/code> on a <strong>focusable<\/strong> element .<\/p>\n<p>Using either of these on a <strong>focusable<\/strong> element will result in some users focusing on &#8216;nothing&#8217;.<\/p>\n<p>Applying <code>aria-hidden<\/code> to a parent\/ancestor of a visible interactive element will also result in the interactive element being hidden, so <strong>don&#8217;t do this either<\/strong>:<\/p><\/blockquote>\n<h2>bad behaviour<\/h2>\n<ul>\n<li>Chrome exposes focusable aria-hidden content with <code>focusable, invisible<\/code> states in the accessibility tree. Firefox does not.<\/li>\n<li>The content exposed by Chrome is ignored by NVDA, or Narrator (am guessing it&#8217;s because they have the invisible state)<\/li>\n<li>JAWS\u00a0 conveys role, state and property information as per usual.<\/li>\n<li>On Mac, VoiceOver with Chrome and Safari, acts similarly to JAWS.<\/li>\n<li>On iOS the aria-hidden content is ignored by VoiceOver in both Chrome and Safari.<\/li>\n<li>Anecdotal observations:\n<ul>\n<li>Accessible names are announced incorrectly at times on aria-hidden interactive content.<\/li>\n<li>Non-interactive content semantics is still hidden from users.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>What can we do?<\/h2>\n<p>To avoid exposing content when it is supposed to be hidden from SR users, <strong>do not<\/strong> put <code>aria-hidden=true<\/code> on focusable elements or include focusable elements as descendants of an element with <code>aria-hidden=true<\/code>, as the results are almost <em>always<\/em> sub-optimal.<\/p>\n<p>Check your usage of <code>aria-hidden<\/code> to ensure that you are only hiding content that you want to hide:<\/p>\n<h2>Visual Bookmarklet for identifying <code>aria-hidden<\/code> content<\/h2>\n<p>As mentioned in the intro, an issue for developers is that use\/misuse of <code>aria-hidden<\/code> is not surfaced for non screen reader users. To help developers I have put together a bookmarklet to visually indicate content, along with some test cases. Go play yourself<\/p>\n<figure id=\"attachment_436\" aria-describedby=\"caption-attachment-436\" style=\"width: 500px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-436 size-full\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/usual.gif\" alt=\"heading and blockquote with text 'Text available to all except screen readers.'\" width=\"500\" height=\"111\" \/><figcaption id=\"caption-attachment-436\" class=\"wp-caption-text\">The text in the blockquote is visible for sighted users, but not for screen reader users<\/figcaption><\/figure>\n<figure id=\"attachment_435\" aria-describedby=\"caption-attachment-435\" style=\"width: 478px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-435 size-full\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/05\/unusual.gif\" alt=\"aria-hidden content is blacked out with an emoji face sticking its tongue out\" width=\"478\" height=\"107\" \/><figcaption id=\"caption-attachment-435\" class=\"wp-caption-text\">With the bookmarklet enabled <code>aria-hidden<\/code> content is hidden from all users<\/figcaption><\/figure>\n<p class=\"codepen\" style=\"height: 400px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-height=\"400\" data-theme-id=\"5390\" data-default-tab=\"result\" data-user=\"stevef\" data-slug-hash=\"WNpXEdQ\" data-pen-title=\"aria-hidden\">See the Pen <a href=\"https:\/\/codepen.io\/stevef\/pen\/WNpXEdQ\"><br \/>\naria-hidden<\/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<p class=\"note\">PS: Don&#8217;t get me started on <code>aria-hidden=false<\/code><\/p>\n<h2>Further listening<\/h2>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/v7djYYE63Ug\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<details>\n<summary>Lyrics:<\/summary>\n<p>[Verse 1]<\/p>\n<p>This is it, dope from the fly kid<\/p>\n<p>The Ice mic is back with the high bid<\/p>\n<p>Suckers you&#8217;ve lost cos players you&#8217;re not, gangstas you ain&#8217;t<\/p>\n<p>You&#8217;re faintin&#8217;, punk, if you ever heard a gunshot<\/p>\n<p>Yo, the pusher, the player, the pimp gangsta, the hustler<\/p>\n<p>High Roller, dead pres folder<\/p>\n<p>Is cold lampin&#8217; like a black king on a throne<\/p>\n<p>Evil E&#8230;turn up the microphone<\/p>\n<p>So I can ill and break on the rollin&#8217; tape<\/p>\n<p>Another album to make? Great<\/p>\n<p>Islam turn the bass kick up a bit<\/p>\n<p>Hype the snare, now I got a place to sit<\/p>\n<p>And ride the track like a black mack in his &#8216;lac<\/p>\n<p>Hit the corner slow where the girls are at<\/p>\n<p>And kick game the way it should be done<\/p>\n<p>How you gonna drop science? You&#8217;re dumb<\/p>\n<p>Stupid ignorant, don&#8217;t even talk to me<\/p>\n<p>At school you dropped Math, Science and History<\/p>\n<p>And then you get on the mic and try to act smart<\/p>\n<p>Well let me tell you one thing, you got heart<\/p>\n<p>To perpetrate, you&#8217;re bait, so just wait<\/p>\n<p>Till the press shove a mic in your face<\/p>\n<p>Or you meet Boogie Down or Chuck D<\/p>\n<p>Stetsasonic or the Big Daddy<\/p>\n<p>And they ask you about the game you claim you got<\/p>\n<p>Drop science now, why not?<\/p>\n<p>You start to sweat and fret, it gets hot<\/p>\n<p>How&#8217;d you get into this spot?<\/p>\n<p>You played yourself&#8230;<\/p>\n<p>Yo, yo, you played yourself&#8230;<\/p>\n<p>[Verse 2]<\/p>\n<p>I&#8217;m no authority but I know the D-E-A-L<\/p>\n<p>When it comes to dealin&#8217; with the females<\/p>\n<p>What you got they want, cash is what they need<\/p>\n<p>Slip sucker and they&#8217;ll break you with speed<\/p>\n<p>But you meet a freak, you try to turn her out<\/p>\n<p>Spendin&#8217; money&#8217;s what I&#8217;m talkin&#8217; about<\/p>\n<p>But you fool out, your pockets got blew out<\/p>\n<p>And after the date, no boots, you got threw out<\/p>\n<p>Mad and shook cos your duckets got took<\/p>\n<p>Call her up, phone&#8217;s off the hook<\/p>\n<p>But who told you to front and flaunt your grip?<\/p>\n<p>You can&#8217;t buy no relationship<\/p>\n<p>You played yourself&#8230;<\/p>\n<p>Yo, homeboy, you played yourself&#8230;<\/p>\n<p>[Verse 3]<\/p>\n<p>I&#8217;m in the MC game, a lot of MC&#8217;s front<\/p>\n<p>And for the money they&#8217;re sell out stunts<\/p>\n<p>But they claim that they&#8217;re rich and that they keep cash<\/p>\n<p>Yo, let me straighten this out fast<\/p>\n<p>Two hundred thousand records sold<\/p>\n<p>And these brothers start yellin&#8217; &#8217;bout gold?<\/p>\n<p>You better double that, then double that again<\/p>\n<p>And still don&#8217;t get sooped, my friend<\/p>\n<p>You think you&#8217;ve made it, you&#8217;re just a lucky man<\/p>\n<p>Guess who controls your destiny, fans<\/p>\n<p>But you diss &#8217;em cos you think you&#8217;re a star<\/p>\n<p>That attitude is rude, you won&#8217;t get far<\/p>\n<p>Cos they&#8217;ll turn on you quick, you&#8217;ll drop like a brick<\/p>\n<p>Unemployment&#8217;s where you&#8217;ll sit<\/p>\n<p>No friends cos you dissed &#8217;em too<\/p>\n<p>No money, no crew, you&#8217;re through<\/p>\n<p>You played yourself&#8230;<\/p>\n<p>That&#8217;s right, you played yourself&#8230;<\/p>\n<p>You played yourself&#8230;<\/p>\n<p>Yo, yo, you played yourself&#8230;<\/p>\n<p>[Verse 4]<\/p>\n<p>You got problems, you claim you need a break<\/p>\n<p>But every dollar you get you take<\/p>\n<p>Straight to the Dopeman, try to get a beam up<\/p>\n<p>Your idle time is spent tryna scheme up<\/p>\n<p>Another way to get money for a jumbo<\/p>\n<p>When you go to sleep you count Five-O&#8217;s<\/p>\n<p>Lyin&#8217; and cheatin&#8217;, everybody you&#8217;re beatin&#8217;<\/p>\n<p>Dirty clothes and you&#8217;re skinny cos you haven&#8217;t been eatin&#8217;<\/p>\n<p>You ripped off all your family and your friends<\/p>\n<p>Nowhere does your larceny end<\/p>\n<p>And then you get an idea for a big move<\/p>\n<p>An armed robbery&#8230;smooth<\/p>\n<p>But everything went wrong, somebody got shot<\/p>\n<p>You couldn&#8217;t get away, the cops roll, you&#8217;re popped<\/p>\n<p>And now you&#8217;re locked, yo, lampin&#8217; on Death Row<\/p>\n<p>Society&#8217;s fault? No<\/p>\n<p>Nobody put the crack into the pipe<\/p>\n<p>Nobody made you smoke off your life<\/p>\n<p>You thought that you could do dope and still stay cool? Fool.<\/p>\n<p>You played yourself&#8230;<\/p>\n<p>You played yourself&#8230;<\/p>\n<p>Ain&#8217;t nobody else&#8217;s fault, you played yourself.<\/p>\n<\/details>\n","protected":false},"excerpt":{"rendered":"<p>hides in the light An interesting feature of aria-hidden is that it hides stuff from screen reader users, but its effects are hidden from everyone else. Unless you going looking for it and understand what it does, you will have no idea how powerful it is and what a detrimental effect it can have if [&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-416","post","type-post","status-publish","format-standard","hentry","category-htmlaccessibility"],"_links":{"self":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/416","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=416"}],"version-history":[{"count":24,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/416\/revisions"}],"predecessor-version":[{"id":447,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/416\/revisions\/447"}],"wp:attachment":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/media?parent=416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/categories?post=416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/tags?post=416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}