Form controls and their focus and selected-state cues need at least 3:1 contrast against adjacent colours, unless the control is inactive. The failures that get through are small. A checkbox looks the same whether it is ticked or not. A text box border fades into the page. The focus ring that shows where a keyboard user is working disappears against a white background. The person who built the form rarely notices, because they already know where everything is. A new customer does not.
This post gives you three rules for contrast on form controls and focus. Each rule comes with a decision path: what to check first, then which way to go depending on what you find. The rules come from the non-text contrast criterion in the Web Content Accessibility Guidelines (WCAG). The W3C's understanding page for that criterion explains the reasoning in more depth than this post can.
The order of the steps matters. A control that a customer cannot name is hard to judge for contrast, because you cannot tell what the customer is supposed to do with it. So the checks run from the inventory outward: first what the controls are, then whether they can be seen, then whether their states can be seen.
This post covers non-text contrast only: control edges, icons, state markers, and focus indicators. Text has its own rules, and this post leaves them aside. You need a colour contrast checker to measure colours and a keyboard to move through the form. Nothing else is required for the checks below.
Start with an inventory of controls and states
Open the onboarding flow as a new account would see it. Go through every step, including any step that appears only after an earlier choice. A branch you skip is a branch a customer may hit on day one. List each control: text inputs, drop-down lists, checkboxes, radio buttons, switches, date pickers, file upload buttons, icon buttons such as a remove-row cross, and the main next or submit button. For each one, note its states: resting, hovered, focused, selected or ticked, in error, and disabled.
For each control, ask one question: what visual cue tells a customer this is a control, and how do they operate it? The cue might be a border around a text box, a ring around a radio button, a track and knob on a switch, or the outline of a button. Write the cue next to the control in your list. Those cues are what you will measure in the rules below. If you cannot name the cue, that is a finding in itself, because the customer will have to guess.
Next, check the names. If a control has a visible label, its name is clear. If it has no visible name, such as an icon-only remove button, the customer has nothing to read. The MDN guidance on the aria-label attribute says: "If there is no visible name for the element you can reference, use aria-label to provide the user with a recognizable accessible name." A missing name is not a contrast problem, but it fails the same customer, so fix it on the same pass.
Which way to go depends on what you found. If every control has a name and a visible cue, move on to rule one. If any control lacks either, fix the missing name or cue before measuring contrast. Keep the list open while you work through the rules, because each rule adds a column to it: a measured ratio for the cue, a second ratio for the focus, and a note on any state that needs a fix.
Rule 1: the cue that shows a control is there must reach 3:1
The first rule covers the cue that tells a customer a control exists. The WCAG criterion says that, unless the control is inactive, any visual information needed to identify that a control is present and how to operate it must have a minimum 3:1 contrast ratio with the adjacent colours. The adjacent colours are the ones touching the cue: usually the page background, or the fill inside the control.
Measure each cue against its neighbour. For a text box, measure the border against the page background, or against the field fill if the field is tinted. For a radio button, measure the ring against the page. For a switch, measure the track against the page and the knob against the track. Record each ratio beside its control in your list.
Pick the colours carefully. Sample the colour that actually touches the cue on screen, not the colour your design file says the background should be. Backgrounds often carry a tint, a gradient, or a shadow, and each of those changes the number. If the field sits on a card that is slightly off-white, measure against the card, because that is what the customer sees. Measure the cue in its resting state first, then again if it changes on hover or when the field is in error, since a border that is clear at rest can fade in a different state.
Then decide what to do with the result:
- If the cue reaches 3:1, it passes this rule. Move on to the next control.
- If it falls short, change the cue's colour or fill to increase contrast against its neighbour. Then measure it again. Re-measuring is the only way to know it passes.
Treat 3:1 as a threshold, not a target to round toward. A border that measures just under 3:1 does not pass because it looks close enough.
The W3C gives a clear pass example. A customised checkbox has a light grey check mark (#E5E5E5) sitting inside a purple box (#6221EA), and the check mark has a contrast ratio of 5.6:1 with that box.
The criterion exempts inactive controls. Keep that exception separate from your measurements of the cues on controls a customer can operate.
Rule 2: focus and selected states need 3:1 too
The second rule covers the marks that show a state, and focus is the state that most often gets missed. The WCAG criterion says that visual information used to indicate state, such as whether a component is selected or focused, must also ensure that the information used to identify the control in that state has a minimum 3:1 contrast ratio. A keyboard user depends on the focus indicator to know where they are. If the indicator is hard to see, they lose their place in the form.
Start with a keyboard test. Click somewhere neutral on the page so nothing has focus. Press Tab once at a time and move through every control in order. At each stop, look closely or take a screenshot. Can you say which control has focus? If you cannot find the focus on a control, that control needs a visible focus cue. Also check that the order of stops follows the order of the form. A focus that jumps to the footer and then back up is confusing even if it is visible.
Then decide what to do with what you see:
- If there is no visible focus at all, check whether a style rule has removed the browser's default outline without replacing it. Put a visible focus style back on every control, including icon buttons and switches.
- If focus is visible but faint, measure the focus indicator against the colour next to it. The W3C gives a focused button as an example, with a grey (#949494) focus indicator against white, at a contrast ratio of 3:1, and it counts as sufficiently contrasting. Use that as the floor. If your focus colour measures lower, change the colour and measure again.
- If focus is strong but the field barely changes, the customer may not notice the change at all. Measure both the resting state and the focused state, then make sure the focused state has its own clear cue, such as a heavier border, not only a slightly different grey.
Selected states follow the same test. Check the ticked and selected states in your list, not only the resting state. A resting view can hide a problem that appears once a customer ticks something.
Error states count too. If a field turns red to show that something is wrong, the visual cue that marks the field as in error is state information, so check it against the colour next to it. A red outline on a white page is a cue that has to be measured like any other. For the wording itself, see onboarding form error messages.
Rule 3: compare state cues with adjacent colours
The third rule is about when the test applies to a change in colour. The WCAG criterion does not require that changes in colour that differentiate between states of an individual component meet the 3:1 contrast ratio when they do not appear next to each other. A resting border and a focused border shown one at a time are each measured against the colour around them.
Work out which colours actually touch the cue. For a radio group, inspect the selected circle and its surroundings. Seeing selected and unselected options in the same view does not by itself make their colours adjacent. For a single text field, inspect the resting border and the focused border against their own neighbours.
Then decide:
- If the state cue touches another colour, measure the cue against that adjacent colour.
- If the states appear one at a time, measure each state against the colour around it, and stop there.
- If a state is shown only by a small colour change, add a second cue, such as a tick, a filled circle, or a change in shape. A customer who cannot see a subtle colour change still needs another way to know what happened. This is a good habit even when the colour passes.
Hover is a state too, but it is the one most likely to be missed on a touch screen, where a customer may never see it. Do not rely on hover to show that a control exists or that it is active. The cue that a control is clickable should be visible without the pointer over it, and the hover style should add to that cue rather than replace it.
Walk through one example form
Imagine an onboarding step with four controls: an "Accept the terms" checkbox, a radio group asking how many people will use the account, a "Send a weekly summary" switch, and a red-cross icon button that removes a user from a list. The page background is white. The example is made up to show the order of the checks, not to describe any real form.
Start with the inventory. The checkbox has resting, focused, and ticked states. The radio group has an unselected and a selected state for each option. The switch has an off and an on state. The icon button has no visible text, so it has no visible name.
Name first. The icon button needs an accessible name. Give it an aria-label such as "Remove this user", so a customer using a screen reader hears what it does. Then move on, because the other checks depend on knowing what each control is for.
Rule one. Measure the checkbox border against the white page. If it is pale grey and falls short of 3:1, darken it. Measure the radio ring the same way. Measure the switch track against the page and the knob against the track. Measure the icon button's outline or shape against the page as well. If the switch is off and its track is almost the same colour as the page, the customer may not see that it is a switch at all, so that track needs a stronger cue.
Rule two. Tab through the form. Suppose a style rule has removed the focus outline on the checkbox. Put a visible focus style back. Measure the focus style on the icon button against white. If it is faint, change its colour and measure again. Then check the ticked checkbox, the selected radio, and the switch in its on state, since those states carry information too.
Rule three. For the radio group, measure the selected dot against the colour immediately around it. The checkbox's focused state appears alone, so measure it against its own neighbour and stop there. The switch changes from off to on, but the two states are never shown together, so each one is measured against its own surroundings.
You now have a list of cues, a record of measured ratios, and a set of fixes that are specific and testable. Each fix is a single change to a single control, which makes it easy to check again after the change.
What to do with the results before launch
Sort your findings into three groups: fix now, fix before launch, and note for later. Anything that fails rule one or rule two for a control a new customer must use goes in the fix-now group. A missing name goes there too. Record optional improvements separately from failed contrast checks, so a clear second cue does not hide a ratio that still needs a fix.
Test again in the real flow, not in the design file. Layout changes, background tints, and dark mode all change the colours next to a control. Recheck focus and selected states after any restyle, even a small one. A fix that passed last week can fail after a designer changes a background shade, and nobody on the team may notice until a customer reports it.
Record what you tested: the controls you listed, the states you checked, the ratios you measured, and the fixes you made. A short record lets the next person repeat the check without starting over, and it gives you evidence if a customer later reports that they could not find a control. Keep the record with the form's version number so it stays tied to the form it describes.
If you are not the person who designs the form, ask the designer for the colour values of the backgrounds and the states before you start. You will still measure the rendered colours yourself, because the rendered colour is what the customer sees, but the design values tell you where to look first. If the designer and your measurement disagree, the rendered result wins, and the disagreement is worth raising with the design team so it does not repeat on the next form.
Send the form back to design when a control fails rule one or rule two and the fix is a colour change that the design system does not allow. If the fix is structural, such as adding a visible label, note the specific control in the ticket so the change is easy to find. A ticket that names one control and one state is easier to act on than one that says the form needs better contrast.
Related guides
Sources
Limits of this post
This post is general operational information, not legal advice about notice periods or renewal clauses. It does not promise that any method keeps a customer. Software can get a fact wrong, so open the sources before you act.