Search topics
Required fields marked only by colour
A booking form marks required fields only by red labels, with no word, symbol or required attribute, so people who can't see the red can't tell which.
class="is-required" The problem
People who can't see the red, or don't know what it means, find out which fields are required only when the form is sent back
A cookery school's booking form asks for a full name, an email address, a phone number and any dietary needs. The labels "Full name" and "Email" are red; "Phone" and "Dietary needs" are dark grey. The designer meant red to say "required", and to them it obviously does. Someone who can't tell red from grey sees four ordinary labels, and so does anyone who prints the page in black and white: the red and the dark grey come out as almost the same grey. A screen reader user hears "Full name, edit text" and "Phone, edit text", with nothing to set them apart. A visitor who fills in only their phone number and presses "Book my place" gets the form back with two errors, and learns the rules only then.
3.3.2 asks for labels or instructions when content needs input. Which fields must be filled in is one of those instructions: the W3C Understanding page names required fields as an example. Here that instruction is given by colour alone, and nothing in the page explains the colour, so most people don't receive it. The fields also have no required attribute, so the browser can't tell assistive technology that they are required.
1.4.1 asks that colour is never the only visual way to convey information or tell things apart. Here it is: the required labels differ from the others by hue alone, in the same font, size and weight. The Understanding page counts a difference in lightness as a second cue when the two colours reach 3:1 against each other, but this red (#b3261e) and the dark grey (#4a4541) reach only 1.45:1, so in greyscale they look the same. The browser lets it through because a colour carries no meaning for it: .is-required is only a style, and nothing about it reaches the page's structure or the person who can't see it. The fix for 3.3.2 and 1.4.1 is the same: put the instruction in words or a visible mark.
The barrier is invisible to the people who made the form, because they know what the red means. Everyone else pays for it with a failed submission, and on a phone that often means scrolling back up through the form to find the fields with errors.
4 of 10 groups affected
- No vision (affected)
- Low vision (affected)
- Colour vision (affected)
- No hearing (not affected)
- Hard of hearing (not affected)
- No speech (not affected)
- Motor (not affected)
- Reach, strength (not affected)
- Cognitive (affected)
- Seizures (not affected)
- Without perception of colour People who can't tell red from black see four identical labels and no sign that two fields must be filled in.
- Without vision Without the required attribute, a screen reader announces each field the same way, so the colour says nothing at all.
- Limited language, cognitive and learning abilities Even when the red is visible, its meaning is a guess, and people learn they were wrong only when the form comes back with errors.
- Limited vision At high zoom or with a magnifier, only one label is in view at a time, so there is no other label to compare its colour with.
Scanners check that each field has a label, and these do, so the form passes. A contrast check passes the red as well: #b3261e is 6.54:1 on white, readable text, and nothing compares it with the grey labels beside it. No rule can tell that a red label was meant to mean "required", or that the server rejects an empty email. A quick AI fix often adds aria-required="true" to the red fields: screen reader users then hear "required", but the visible form is unchanged, and everyone who can't read the colour is still guessing. Another common patch adds an asterisk with no explanation, which leaves people wondering what the star means. Whether the visible marks match what the server needs is something a person has to compare.
Try it
Which fields must you fill in? Decide, then press Tab through the form
Turn on greyscale: on the broken form, the red labels now look like the rest, because colour was the only sign. Below it, check whether a screen reader hears "required".
Broken Can you fix this?
The fix
Mark required fields in words, and in the code
<style> label { color: #4a4541; } .is-required { color: #b3261e; }</style> <label for="name" class="is-required">Full name</label><input id="name" name="name" type="text" autocomplete="name"> <label for="email" class="is-required">Email</label><input id="email" name="email" type="email" autocomplete="email"> <label for="phone">Phone</label><input id="phone" name="phone" type="tel" autocomplete="tel"> <label for="diet">Dietary needs</label><input id="diet" name="diet" type="text">What is wrong3 points
- People who can't see the red can't tell which fields are required. The only difference is the colour of the label, and the red and the grey are only 1.45:1 apart, where a difference in lightness needs 3:1 to count as a second cue.
- People who do see the red still have to guess what it means: nothing on the page explains it.
- A screen reader announces every field the same way: the code doesn't mark any field as required.
"required" in each required label
<style> label { color: #4a4541; }</style> <label for="name">Full name <span class="req">(required)</span></label><input id="name" name="name" type="text" autocomplete="name" required> <label for="email">Email <span class="req">(required)</span></label><input id="email" name="email" type="email" autocomplete="email" required> <label for="phone">Phone</label><input id="phone" name="phone" type="tel" autocomplete="tel"> <label for="diet">Dietary needs</label><input id="diet" name="diet" type="text">How it is fixed3 steps
- Write "(required)" into each required label. The word is part of the label, so everyone reads it in the same place as the field's name, and needs no key.
- Add the
requiredattribute, which tells assistive technology the same thing: a screen reader says "Full name (required), edit text, required". - Drop the red class, so the labels are all the same dark grey and colour no longer carries anything.
This fixes the Before and passes 3.3.2 and 1.4.1. You can keep the red as extra styling on the word, as long as the word is there.
Why this fix: Say it in words, not only in the styling
All three pass 3.3.2 and 1.4.1, and all three keep the required attribute. Writing "(required)" in each required label needs no explanation and nothing else on the page, so choose it when fewer than about half the fields are required. When nearly every field is required, mark the optional ones instead: the form reads more calmly and the word still sits on each field it applies to. The asterisk is the shortest and the most familiar, and suits sites that already use it on every form: keep it consistent across the site, and make the star large and dark enough to see.
Put the explaining line where people will see it. The optional-field and asterisk fixes both rely on a line before the first field. Keep it directly above the form, not in a page intro or a footer, so people who are zoomed in or arrive at the form from a link still pass it.
Keep the word in the label. Put "(required)" or "(optional)" inside the label element, not in a placeholder, a tooltip or a separate div. Inside the label, it is visible next to the field and part of the name voice control and screen readers use.
Only mark what the server needs. Add required where an empty field is rejected, and nowhere else. A field that says "(required)" but is accepted empty, or the opposite, teaches people to ignore the marks. Generate the mark and the attribute from the same field setting in your form component, so they can't drift apart.
Browser validation. The required attribute also turns on the browser's own check and its message bubble. If you show your own error messages, add novalidate to the form: the fields keep required, so screen readers still announce it, and your errors take over. For the messages themselves, see the guide on form errors.
Custom controls. A custom dropdown or date picker built from divs can't take required. Give it aria-required="true" alongside the visible word, or, better, replace it with a native control.
Groups of radio buttons and checkboxes. Put the word in the legend, not on each option: "Course date (required)". Add required to each radio button in the group.
Japanese forms. Many Japanese forms use a 必須 badge. That passes, because it is text: keep it inside the label, give it enough contrast, and don't rely on its colour alone.
Design ideas
“Required” needs a word, or a mark that is explained
Four ways to show that Email must be filled in and Phone need not. Picture each one without colour, and Tab through the last one: two say which field is required before you type, and two leave you to guess or to find out.
In the design file
- Put the word “(required)” or “(optional)” in the label, next to the field name, not in the grey example text or a tooltip.
- If you use a mark such as an asterisk, explain it in a line just above the first field.
- For a set of radio buttons or checkboxes, write the word once in the group’s heading, not on each option.
- Write the red’s contrast ratio next to its colour. The example has 6.54:1 for the word on white and 5.58:1 for the badge on its pale background.
Passes
- “Required” as a pill in the label The word set as a soft pill beside the label, #b3261e on a #fbe9e7 tint at 5.58:1: it catches the eye like a colour mark but still reads in greyscale, and it is the 必須 badge many Japanese forms already use. Keep the pill inside the label, so it is part of the field’s name.
Rule of thumb: Say it in words, not only in the styling
- Required and optional fields in two groups The fields sit under two section headings, “Required” and “Optional”, so one word covers every field below it and people see at a glance how much they must do. W3C technique H90 lets a group’s legend carry the required state instead of each label; the headings are #4a4541, 9.46:1.
Rule of thumb: Say it in words, not only in the styling
Fails
- An asterisk nobody explainedWCAG 3.3.2 A bold #b3261e star after the Email label, 6.54:1, and no line anywhere saying what it means, so only people who already know the convention read it as “required”. H90 asks for a symbol’s meaning before its first use.
- “Required” only after you leave the fieldWCAG 3.3.2 Both fields look the same until you Tab out of Email with it empty; only then does “Enter your email address” appear under it, in #b3261e at 6.54:1. The message is clear, but people learn the rule only by breaking it, and 3.3.2 asks for it before they type.
Verify the fix
4 checks, no mouse.
Test with: Keyboard, Screen reader, Zoom
Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat when fields are added to the form or the shared field component changes.
Limits
This is a starting pattern, not a guarantee for every application. It covers how people learn which fields are required before they type, not the error messages they see afterwards. Formats, such as a date order or a postcode pattern, are instructions too, and need their own text. An explaining line that only names a colour or a symbol's look, such as "fields in red are required", is itself one of the instructions that rely on colour, shape or position. Forms built by third-party widgets or content editors need the same check. Test the complete journey with your target assistive technology.
This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.
References
- WCAG Understanding: labels-or-instructions (opens in a new tab)
- WCAG Understanding: use-of-color (opens in a new tab)
- WCAG Technique H90 (opens in a new tab)
- WCAG Technique ARIA2 (opens in a new tab)
- WAI Tutorial: forms/instructions (opens in a new tab)
- developer.mozilla.org: required (opens in a new tab)
EaseWeb service
Fixed it? Keep it from coming back.
I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.