{"id":1412,"date":"2024-11-04T15:59:00","date_gmt":"2024-11-04T15:59:00","guid":{"rendered":"https:\/\/html5accessibility.com\/stuff\/?p=1412"},"modified":"2024-11-04T15:59:00","modified_gmt":"2024-11-04T15:59:00","slug":"disabled-and-obscured","status":"publish","type":"post","link":"https:\/\/html5accessibility.com\/stuff\/2024\/11\/04\/disabled-and-obscured\/","title":{"rendered":"disabled and obscured"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1416\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-31-120030.jpg\" alt=\"section of a metal utilities cover with raised dots and the word 'SUPRASTEEL'\" width=\"1024\" height=\"653\" srcset=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-31-120030.jpg 1024w, https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-31-120030-300x191.jpg 300w, https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-31-120030-768x490.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/>The WCAG <a href=\"https:\/\/www.w3.org\/WAI\/WCAG21\/Understanding\/contrast-minimum.html\">success criterion 1.4.3: Contrast (Minimum)<\/a>\u00a0 requires that:<\/p>\n<blockquote><p>The visual presentation of text and images of text has a contrast ratio of at least 4.5:1<\/p><\/blockquote>\n<p>There are several exceptions to this rule, including:<\/p>\n<blockquote><p>Text or images of text that are part of an inactive\u00a0<a href=\"https:\/\/www.w3.org\/WAI\/WCAG21\/Understanding\/contrast-minimum.html#dfn-user-interface-component\">user interface component<\/a><\/p><\/blockquote>\n<p>Which means in HTML that interactive elements with a <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Attributes\/disabled\"><code>disabled<\/code><\/a> attribute are exempt.<\/p>\n<p>So, for example, the text label for a <code>button<\/code> with a <code>disabled<\/code> attribute is not required to be legible.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1417\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-31-134842.jpg\" alt=\"display of a disaabled button in Chrome, with the text 'help I'm a rock' with low contrast against the dimmed button background.\" width=\"193\" height=\"53\" \/><\/p>\n<pre>&lt;button <mark><strong>disabled<\/strong><\/mark>&gt;help I'm a rock&lt;\/button&gt;<\/pre>\n<p class=\"note\">My personal take on this is <strong>it sucks<\/strong> as while the control is disabled for all, only for a subset of users (low vision) the text label for the disabled control is illegible.<\/p>\n<p>The other property of <code>disabled<\/code> controls that causes consternation are that they are not included in the focus order. Explicit addition of <code>tabindex=\"0\"<\/code> makes no difference.<\/p>\n<p>Be that as they may, these properties (poor contrast and not being focusable) were built into the default characteristics of <code>disabled<\/code> controls on the web as rendered in browsers. So it is understandable that they are exempt from the relevent WCAG success criteria.<\/p>\n<h2>Not so fast with the exemption<\/h2>\n<p>The reason given for the exemption to contrast requirements has traditionally been &#8220;well that&#8217;s how browsers implement it by defult&#8221;<\/p>\n<p>Recently there has been a suggestion to update the related WCAG informative documentation to clarify that any label text for disabled elements are also included in the exemption:<\/p>\n<p class=\"Box-sc-g0xbh4-0 iiPkrN prc-Heading-Heading-6CmGO\" data-component=\"PH_Title\"><a href=\"https:\/\/github.com\/w3c\/wcag\/issues\/3725\"><bdi class=\"Box-sc-g0xbh4-0 kHFseR markdown-title\" data-testid=\"issue-title\">Does the SC 1.4.3 Contrast minium exception apply to text outside a disabled control?<\/bdi><\/a><\/p>\n<blockquote>\n<p data-component=\"PH_Title\">Therefore, an input field along with its label is considered a single user interface component. As a result, the label itself is not required to meet minimum contrast ratio requirements.<\/p>\n<\/blockquote>\n<p data-component=\"PH_Title\">Example code: the update to the informative documentation suggests that the text in the label should also be exempt from color contrast requirements:<\/p>\n<pre>&lt;label for=\"text0\"&gt;<mark>type=\"text\"<\/mark>&lt;\/label&gt;\r\n\r\n&lt;input type=\"text\" id=\"text0\" disabled&gt;\r\n\r\n<\/pre>\n<p>I don&#8217;t agree with this:<\/p>\n<ul>\n<li style=\"margin-bottom: 0px;\">No browsers (I tested) change the default contrast of text in <code>label<\/code>\u00a0elements. So why would we open a door to designers\/developers to reduce the default text contrast?<\/li>\n<\/ul>\n<p>Upon investigation of the way browsers implement the display of controls and their associated text labels and other text UI, the following were observed:<\/p>\n<ul>\n<li><strong>All browsers<\/strong> (I tested) implement disabled controls as non focusable.<br \/>\n<strong>Note:<\/strong> adding <code>tabindex=\"0\"<\/code> does not make them focusable<\/li>\n<li><strong>Some browsers<\/strong> dim the text labels that are children of, or the value of an attibute (e.g. <code>value=\"submit\"<\/code>) for elements that have a <code>disabled<\/code> attribute.\n<ul>\n<li style=\"text-align: left;\">Chrome dims the text leading to poor contrast<\/li>\n<li>Firefox does not dim the text, leading to better contrast<\/li>\n<li><code>placeholder<\/code> text is not dimmed in Chrome leading to better contrast, but is in Firefox leading to poor contrast<\/li>\n<li>Safari on iOS does not dim disabled controls text labels, and neither do other browsers on iOS.<\/li>\n<\/ul>\n<\/li>\n<li>Default input masks on things like <code>type=\"date\"<\/code> are not dimmed on disabled controls are not dimmed on any browser (I tested), leading to better contrast in Firefox and Chrome.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1431\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/11\/type-date-firefox.jpg\" alt=\"Firefox disabled date input has legible text input mask\" width=\"276\" height=\"31\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1432\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/11\/type-date-chrome.jpg\" alt=\"Chrome disabled date input has legible text input mask\" width=\"350\" height=\"34\" srcset=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/11\/type-date-chrome.jpg 350w, https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2024\/11\/type-date-chrome-300x29.jpg 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/li>\n<li><strong>No browsers<\/strong> (I tested) implement default changes in the visual styling of text in a <code>&lt;label&gt;<\/code> associated with a <code>disabled<\/code> element.<\/li>\n<\/ul>\n<h3>Disabled HTML controls: Try it for yourself:<\/h3>\n<p class=\"codepen\" style=\"height: 500px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-height=\"500\" data-default-tab=\"result\" data-slug-hash=\"RwXZGYO\" data-pen-title=\"html disabled controls\" data-user=\"stevef\">See the Pen <a href=\"https:\/\/codepen.io\/stevef\/pen\/RwXZGYO\"><br \/>\nhtml disabled controls<\/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<h2>Bring on WCAG III<\/h2>\n<p>The current normative exceptions in WCAG 2.2 cannot be removed, but there is <em>no way<\/em> we should be extending the informative documentation to include UI that has up until now not been considered as exempt.<\/p>\n<h2>Zappa &#8211; Help I&#8217;m a Rock<\/h2>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/KOH7o8Vw6Mc?si=RAbjge9qIxoD6U4I\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<details>\n<summary>Lyrics<\/summary>\n<pre>Help I'm a rock, help I'm a rock, help I'm a rock!\r\nAhahahahahahaaa\r\nHelp I'm a rock, help I'm a rock, help I'm a rock!\r\nSomebody, please, please!\r\nHelp I'm a rock, help I'm a rock...\r\nWow man, it's a drag being a rock\r\nHelp I'm a rock...\r\nI wish I was anything but a rock\r\nHeck, I'd even like to be a policeman\r\nHey, you know what, you know maybe if I practised, you know\r\nMaybe if I passed my driving test\r\nI could get a gig drivin' that bus and pick some freaks up\r\nIn front of Ben Franks, right!\r\nHelp I'm a cop, help I'm a cop, help I'm a cop!\r\n, help I'm a cop, help I'm a cop!\r\nIt's a drag being a cop, I think I'd rather be the mayor\r\nAlways wondered what I was gonna be when I grew up, you know\r\nAlways wondered whether or not, whether or not I could make it,\r\nYou know, in society, because,\r\nYou know, it's a drag when you're rejected\r\nSo I tore the cover off a book of matches and I sent in\r\nAnd I got this letter back that said, UHU, AHA\r\nIt can't happen here\r\nIt can't happen here\r\nI'm telling you, my dear\r\nThat it can't happen here\r\nBecause I been checkin' it out, baby\r\nI checked it out a couple a times, hmmmmmmmm\r\nAnd I'm telling you\r\nIt can't happen here\r\nOh darling, it's important that you believe me\r\nThat it can't happen here\r\nWho could imagine that they would freak out somewhere in Kansas...\r\nKansas Kansas tototototodo\r\nKansas Kansas tototototodo\r\nKansas Kansas\r\nWho could imagine that they would freak out in Minnesota...\r\nMimimimimimimi Minnesota, Minnesota, Minnesota\r\nWho could imagine...\r\nWho could imagine\r\nThat they would freak out in Washington, D.C.\r\nD.C. D.C. D.C. D.C. D.C.\r\nIt can't happen here\r\nBa ba ba ba ba ba ba ba\r\nIt can't happen here\r\nIt can't happen here\r\nEverybody's safe and it can't happen here\r\nNo freaks for us\r\nIt can't happen here\r\nEverybody's clean and it can't happen here\r\nNo, no, it won't happen here\r\nI'm telling you it can't\r\nIt won't happen here\r\nPlastic folks, you know\r\nIt won't happen here\r\nYou're safe, mama\r\nYou're safe, baby\r\nYou just cook a TV dinner\r\nAnd you make it\r\nNo no no no\r\nOh, we're gonna get a TV dinner and cook it up\r\nGo get a TV dinner and cook it up\r\nCook it up\r\nOh, and it won't happen here\r\n(No no no no no no no no no no no\r\nMan you guys are really safe\r\nEverything's cool).\r\nWho could imagine\r\nWho could imagine\r\nThat they would freak out in the suburbs!\r\nI remember (tu-tu)\r\nI remember (tu-tu)\r\nI remember (tu-tu)\r\nThey had a swimming pool\r\nI remember (tu-tu)\r\nI remember (tu-tu)\r\nThey had a swimming pool\r\nI remember (tu-tu)\r\nI remember (tu-tu)\r\nThey had a swimming pool.\r\nAnd they thought it couldn't happen here\r\nThey knew it couldn't happen here\r\nThey were so sure it couldn't happen here\r\nBut...\r\nSuzie...\r\nYes yes yes--I've always felt that\r\nYes I agree man, it really makes it...yeah...\r\nIt's a real THING, man\r\nAnd it really makes it\r\nSuzie, you just got to town,\r\nAnd we've been, we've been very interested\r\nIn your development.\r\nForget it!\r\nHmmmmmmmmm\r\n<\/pre>\n<\/details>\n","protected":false},"excerpt":{"rendered":"<p>The WCAG success criterion 1.4.3: Contrast (Minimum)\u00a0 requires that: The visual presentation of text and images of text has a contrast ratio of at least 4.5:1 There are several exceptions to this rule, including: Text or images of text that are part of an inactive\u00a0user interface component Which means in HTML that interactive elements with [&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-1412","post","type-post","status-publish","format-standard","hentry","category-htmlaccessibility"],"_links":{"self":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/1412","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=1412"}],"version-history":[{"count":20,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/1412\/revisions"}],"predecessor-version":[{"id":1437,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/posts\/1412\/revisions\/1437"}],"wp:attachment":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/media?parent=1412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/categories?post=1412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/tags?post=1412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}