I get that using placeholder text as a label is not very accessible, but does it technically go against WCAG 2? I could not find anything explicit but I wonder if a more lawyerly reading of that standard would find something in there.
Does using a placeholder as a label comply with WCAG 2?
2.4k views Asked by tylertrotter AtThere are 2 answers
Adam
On
Real short answer: it's not sufficient to satisfy all success criterion
2.5.3: Label in Name states that the placeholder may be candidate for "Label in name".
This does not mean that this would satisfy 3.3.2 Labels or Instructions.
While placeholder text provides valuable guidance for many users, placeholder text is not a replacement for labels. Assistive technologies, such as screen readers, do not treat placeholder text as labels.
The SC 3.3.2 does require a visible label (text or icon, eg. a Search form with a a magnifying glass button) or instructions.
This has also been discussed on the WCAG github about "hidden labels".
If you object that a placeholder is not "hidden", it won't be the case anymore once the field has been filled and it might be difficult to understand its meaning when using a screen magnifier for instance). It is also subject to browser autofill feature.
So using a placeholder, in fact, does not go against WCAG, it's just not sufficient : the 2.5.3 SC will be inapplicable when the placeholder is not visible and 3.3.2 will fail unless instructions or other techniques are used.
Related Questions in ACCESSIBILITY
- Why does getRootInActiveWindow() always returns null in Accessibility Event
- Accessibility : Full keyboard access with scroll view in swiftui
- How to create an overlay window over a certain element via AccessibilityService and scroll it too?
- Problem with Delphi android app and talkback
- How can I get the screen reader to read controls that are not tab stops (e.g. static labels)?
- NVDA is not announcing "dialog" when Modal opens
- Accessibility sequence not working with "HorizontalPager" in Android Jetpack Compose
- Android recyclerview - cant able to navigate items using accessibility focus
- Using aria-describedby to reference description that contains more than just text
- What is the correct usage of aria-describedby?
- How to make related checkboxes accessible using wai-aria tags?
- How to close compose dialog in accessibility mode?
- How do I make an "add to list" pattern accessible for assistive technology users?
- Autogenerate link title based on URL/target for accessibility
- typeViewClicked event is not detected when target window is developed by jetpack compose by my accessibilityservice
Related Questions in PLACEHOLDER
- Placholder for TbExtendedGridView search input
- How to get the input of a placeholder in Flask
- I want to change ng2-smart-table search placeholder text
- Adding "required" placeholder text for all required fields (Angular Material)
- What is the problem in this code? I am getting a problem in this piece of code
- Laravel Filament v3.1 and Carbon how to update PlaceHolder content dynamicaly
- Handling dynamically added UserControl's buttons
- Adding placeholder to JQuery (AJS.$) MultiSelect Field (Jira, JavaScript)
- Skeleton loader blinks when the data loads too fast
- Show a Placeholder on WooCommerce Checkout Billing Email Field if no value is displayed by Default
- spring boot project xml bean in jar can not refer application.properties
- laravel input paleholder does not show
- How do I keep the Placeholder in this React-Select Drop Down Menu Untill a User Selects Option?
- Solution For Customizing DataTable Search Field
- How to add a placeholder (spinner) while loading Telegram mini app?
Related Questions in WCAG
- How do I make an "add to list" pattern accessible for assistive technology users?
- React Native, when to use accessibilityLabel and accessibilityLabelledBy
- WCAG 1.4.4. Resize text - is it a failure to ellipsize and provide an accessible tooltip?
- Remove focus from listbox options on mouse click only
- How can I improve web accessibility for iframes embedding third-party content (specifically images)?
- Python: How can I split a PDF while preserving Web Accessibility to comply with WCAG?
- Should jumping between words loop in NVDA screen reader?
- What is the semantic difference between a listbox and a group with checkboxes?
- WCAG Color Contrast Checker errors/warnings about things that are not on page. How to find and fix?
- Flutter text size
- How can I effectively use PDFBox 3.0 to tag a PDF document for accessibility compliance and ensure it meets WCAG and PDF/UA standards?
- Can an ordered list item contain a heading and is that accessible?
- Accessible square on a chessboard that has 5 different visual states
- How to make a selectable card component accessible regarding WCAG with React, JS, CSS
- How to mimic bootstrap WCAG algorithm to pick active colors in JavaScript?
Related Questions in SECTION508
- 508 issue: Element is focusable but has or is contained by [aria-hidden=true] (ANDI Tool)
- Label For a Static DIV that shows entered value from a form
- PDF Section 508 - block of text couldn't be tagged
- Make list items in validationsummary in ASP.Net Core link to form fields?
- what are some data table (table with sorting, searching and pagination) options for Angular 15.x that are 508 compliant?
- how can I create 508 compliant radio groups and radio buttons using iText version 7.0
- How to properly set up a11y / aria props for a button input that is labelled but also changes current value?
- Incorrect use of <label for=FORM_ELEMENT> - How to fix?
- Making a Section 508-compliant accessible structure for a printable form
- How to add labels to dropdown menu if the select options are coming from datatables javascript?
- How Do I Modify an EXTjs app to be 508 Compliant?
- 508 Compliance error - "This SPAN has an id attribute of 'aria-context' and 'aria-selection-event', which is not unique in the same DOM"
- Unique ID's for buttons in gridview?
- Accessibility, when pressing Enter on my image the screen reloads
- Meaning of Section 508 Part 1194 6f "Textual Information"
Related Questions in WCAG2.0
- How do I make an "add to list" pattern accessible for assistive technology users?
- WCAG 1.4.4. Resize text - is it a failure to ellipsize and provide an accessible tooltip?
- WCAG Accessibility - require at least one entry from a fieldset
- Can transparent text technically be WCAG compliant if an opaque image of the text is in the same location?
- The case of long labels
- Language of parts for image alt text
- How to prevent screen readers from reading url after redirect?
- No dialog role is announced by JAWS screen reader when dialog is appear in the screen
- A11y correct standard to set focus, when modal is on complete step
- Calculating a text color based off of a background (not just black or white)
- Which all attributes shoud be added to make a button that opens a menu of actions to make it accesible to assistive technology
- WCAG 2.0: Delay scrolling causes issues with SR Utility Menu reading headings
- Accessibility for draggable image
- Keeping Focus on Bootstrap Modal While Tabbing
- Passing a WCAG 2.0 (Level AA) test for a website
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Read first: this is not a suggestion that you should use a placeholder instead of a label, more of a thought experiment as to whether a placeholder is sufficient under WCAG guidance. If you do use a placeholder instead of a label then your site is not accessible as I have stated in hundreds of answers before. If you ever get sued for discrimination I doubt anything in this answer will help you (and neither should it).
To be clear - use a visible and correctly associated label! /endRant hehe.
Short Answer
A placeholder only and no label more than likely DOES comply with WCAG 2.1, but who knows with all the conflicting guidelines.
You would think in tens of thousands of words there would be a line that says "use a label" or "a placeholder only input would fail this criterion" but I couldn't find it.
The following may be hard to read as I read every page I could find to get a definitive answer so it could be a bit disjointed, apologies!
Onto the question
OK so lets assume we do not care about usability for a second and focus on the "letter of the law" with regards to WCAG 2.1, as it is an interesting question.
Now let's also assume we are talking purely about standard
<inputs>and<textarea>s to make this easy (as checkboxes, selects etc. all definitely need labels), plus they are the only ones that accept a placeholder value anyway (I think?!).What rules apply to inputs and labels that may be relevant?
The ones that are relevant here are 1.1.1 Non-text Context, 1.3.1 Info and Relationships, 2.4.6 Headings and Labels, 3.3.2 labels or instructions and 4.1.2 Name, Role, Value. I later found 2.5.3: Label in Name.
1.1.1
Now technically a standard
<input>isn't quite covered here, this criterion is more for things like images used as buttons, custom controls etc.However if we assumed that we could stretch 1.1.1 to cover an
<input>is there anything in this criterion that means we can't use a placeholder (or have to have an associated label).If you read the whole page there is not one specific mention of a
<label>element needing to be used on a form control.outcome: so far no answer either way
1.3.1
Checking 1.3.1 - although it mentions labels, it does not specifically mention the
<label>element anywhere. It also states that it is a "judgement call" as to whether relationships should be programmatically determined or presented in text.outcome: no definitive answer either way
2.4.6
Now we can discount 2.4.6 Headings and labels as that only requires labels are descriptive, it does not specifically state labels must be provided.
outcome: not relevant
3.3.2
Now we are talking, "labels or instructions" must give us some concrete answers, right?
Well that is annoying, no answer here!
In fact it it points us back to 1.3.1, which we already looked at and determined there was no definitive answer.
It also points us to 4.1.2 - maybe we will have some look with that criterion?
outcome: not relevant
4.1.2
Right, this must be it! It starts out on the right track at least!
Now the key part of this is "programmatically determined".
Ok so what is the definition of "programmatically determined"?
Well now we might be onto something. Can different user agents and assistive technologies extract the placeholder information? Is it a valid labelling technique?
outcome: still no definitive answer
This is where we find the relevant WCAG recommendation finally (or do we?)
Success Criterion 2.5.3: Label in Name
2.5.3 label in name must be the confirmation we are looking for, surely.
Within all of that rambling (as you can tell I am sick of reading the convoluted and unclear guidelines.) it says something interesting.
"if an input contains placeholder text, such text may be a candidate for Label in Name."
And with that we would have a "programmatically determined" name for the control. (see next heading)
side note on the paragraph above: The part "Note that placeholder text within an input field is not considered an appropriate means of providing a label." would lead you to believe that a placeholder is not valid as a label.
It also states that "The HTML5 specification states The placeholder attribute should not be used as an alternative to a
<label>."Now to me that would be enough to persuade you to use a label.
However yet again, WCAG says that a webpage should be "valid HTML" (under SC 4.1.1 - Parsing).
So is an
<input>with a placeholder valid HTML? Well the answer (according to the W3C validator is yes! The following is valid HTML!So if it is valid, I would say that is technically acceptable.
The accessible name computation
I got side-tracked there for a second. I was talking about the fact that a
placeholderattribute is a valid candidate for an accessible name computation.Here it is, the accessible name computation for an
<input>. There relevant point is point number 4:OK so
placeholderis valid for "programatically determinable", but doesn't a label have to be visible?Interestingly you do not have to have a visible label for 1.1.1, 1.3.1 and 4.1.2 so we can't use that argument as to needing an actual label.
Taken from H44: Using label elements to associate text labels with form controls
With that being said the next sentence....
But in 3.3.2 although it has to be visible, it doesn't have to be correctly marked up (remember, I did say it a long time ago!).
So there is all the relevant information I could find in WCAG and the outcome is still fuzzy, but with that being said I do have a conclusion for you!
Conclusion
Nowhere in WCAG does it explicitly state that a placeholder cannot be used as a label.
WCAG also states that a
titlecan be used to label aninputand that is worse than a placeholder.It is possible I have missed a key sentence somewhere that would tie it all together but from what i have read I believe (very surprisingly!!) that it is valid under WCAG 2.1 to only have a placeholder on an
<input>.Obviously as I stated several times DO NOT USE A PLACEHOLDER ONLY ON AN INPUT as it is not accessible to a lot of users (people with anxiety disorders or learning difficulties really hate inputs with placeholder labels as the label disappears when they type so they can't check they have filled the correct field in without deleting everything), some screen reader and browser combinations do not work with them etc.