{"id":330,"date":"2021-02-14T11:10:16","date_gmt":"2021-02-14T11:10:16","guid":{"rendered":"https:\/\/html5accessibility.com\/stuff\/?page_id=330"},"modified":"2021-02-14T11:10:16","modified_gmt":"2021-02-14T11:10:16","slug":"re-upped-placeholder-the-piss-take-label","status":"publish","type":"page","link":"https:\/\/html5accessibility.com\/stuff\/re-upped-placeholder-the-piss-take-label\/","title":{"rendered":"re-upped: placeholder &#8211; the piss-take label"},"content":{"rendered":"<h2><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-333\" src=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/02\/placeholder.png\" alt=\"Input with placeholder text 'placeholder as label #SUX'\" width=\"576\" height=\"76\" srcset=\"https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/02\/placeholder.png 576w, https:\/\/html5accessibility.com\/stuff\/wp-content\/uploads\/2021\/02\/placeholder-300x40.png 300w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/h2>\n<p>The reasons why use of the <code>placeholder<\/code> attribute as the only means of providing a user readable prompt for a form control <a href=\"https:\/\/www.w3.org\/WAI\/GL\/low-vision-a11y-tf\/wiki\/Placeholder_Research\">is <em>deficient UX<\/em>, are voluminous<\/a>. It is frustrating having to rehash this discussion <em>endlessly<\/em>.<\/p>\n<p>I first wrote about <a href=\"https:\/\/developer.paciellogroup.com\/blog\/2011\/02\/html5-accessibility-chops-the-placeholder-attribute\/\"><code>placeholder<\/code><\/a> back in 2011, and included <a href=\"https:\/\/www.w3.org\/TR\/html50\/forms.html#the-placeholder-attribute\">a note<\/a>, <a href=\"https:\/\/www.w3.org\/TR\/html5\/sec-forms.html#the-placeholder-attribute\">later a warning<\/a>, about its use in the <em>dear superseded<\/em> HTML5 specification in 2014.<\/p>\n<blockquote><p>\u26a0\ufe0f Use of the placeholder attribute as a replacement for a label can reduce the accessibility and usability of the control for a range of users including older users and users with cognitive, mobility, fine motor skill or vision impairments. While the hint given by the controls label is shown at all times, the short hint given in the placeholder attribute is only shown before the user enters a value. Furthermore, placeholder text may be mistaken for a pre-filled value, and as commonly implemented the default color of the placeholder text provides insufficient contrast and the lack of a separate visible label reduces the size of the hit region available for setting focus on the control.<\/p><\/blockquote>\n<p>Unfortunately for some, the obvious and oft-stated usability\/accessibility <em>crapness<\/em> of <code>placeholder<\/code> as label is not reason enough to avoid using it as a label.<\/p>\n<h2>&#8220;Show us the fail&#8221; they ask:<\/h2>\n<p><strong>The question:<\/strong><\/p>\n<blockquote class=\"twitter-tweet\">\n<p dir=\"ltr\" lang=\"en\">?To conform to 3.3.2 Labels or Instructions (WCAG 2.1 A) does a label have to be present regardless of the state of a control? \/cc <a href=\"https:\/\/twitter.com\/patrick_h_lauke?ref_src=twsrc%5Etfw\">@patrick_h_lauke<\/a><\/p>\n<p>\u2014 Steve Faulkner (@stevefaulkner) <a href=\"https:\/\/twitter.com\/stevefaulkner\/status\/1097793874842603520?ref_src=twsrc%5Etfw\">February 19, 2019<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p><strong>The answer<\/strong>:<\/p>\n<blockquote class=\"twitter-tweet\" data-conversation=\"none\">\n<p dir=\"ltr\" lang=\"en\">Unless the state means that it does not require user-input, or there are instructions instead of \/ as well as a label.<\/p>\n<p>\u2014 Alastair Campbell (@alastc) <a href=\"https:\/\/twitter.com\/alastc\/status\/1097798060124635143?ref_src=twsrc%5Etfw\">February 19, 2019<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<h3>FAIL<\/h3>\n<p><code>placeholder<\/code> as the only visible label for a control that requires user input fails <a href=\"https:\/\/www.w3.org\/TR\/WCAG21\/#labels-or-instructions\">Success Criterion 3.3.2 Labels or Instructions<\/a><\/p>\n<h4>Why?<\/h4>\n<p>At the time of user input there is no visible label, the input purpose is <strong>mystery meat<\/strong>.<\/p>\n<p class=\"codepen\" style=\"height: 376px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-height=\"376\" data-theme-id=\"5390\" data-default-tab=\"result\" data-user=\"stevef\" data-slug-hash=\"eaVdoN\" data-pen-title=\"placeholder fails\">See the Pen <a href=\"https:\/\/codepen.io\/stevef\/pen\/eaVdoN\"><br \/>\nplaceholder fails<\/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>Addendum<\/h2>\n<blockquote class=\"twitter-tweet\" data-conversation=\"none\">\n<p dir=\"ltr\" lang=\"en\">once the user starts typing something in, the label\/instructions are not visible anymore. or if the form is shown back to the user already filled in, those fields won&#8217;t have a visible label\/instruction either. in both cases, this then fails 3.3.2<\/p>\n<p>\u2014 patrick h. lauke #toryScum #clapForFlagWankers (@patrick_h_lauke) <a href=\"https:\/\/twitter.com\/patrick_h_lauke\/status\/1131536768724078592?ref_src=twsrc%5Etfw\">May 23, 2019<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The reasons why use of the placeholder attribute as the only means of providing a user readable prompt for a form control is deficient UX, are voluminous. It is frustrating having to rehash this discussion endlessly. I first wrote about placeholder back in 2011, and included a note, later a warning, about its use in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-330","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/pages\/330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/types\/page"}],"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=330"}],"version-history":[{"count":3,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/pages\/330\/revisions"}],"predecessor-version":[{"id":334,"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/pages\/330\/revisions\/334"}],"wp:attachment":[{"href":"https:\/\/html5accessibility.com\/stuff\/wp-json\/wp\/v2\/media?parent=330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}