Sub topic 13
Checking that it looks clickable
This chapter covers how to test the buttons and links you built in the earlier chapters. It assumes you know basic HTML, CSS selectors and pseudo-classes, the box model, and how to open your browser's developer tools. It also assumes you have read the chapters on button and link design, interaction states, focus indicators, target size, and disabled states, because this chapter checks the results of those choices.
Building a clickable component is half the job. The other half is confirming that real people can recognize it, reach it, and use it. A style sheet can look right in your editor and still fail on a phone, on a keyboard, or for a user who cannot see color differences. This chapter gives you a repeatable checklist and shows how to run each check.
What you are testing
A control "looks clickable" when a user can answer three questions without trying it:
- Is this interactive at all?
- What will happen if I use it?
- Can I use it with the device and abilities I have?
Each check below maps to one of these questions. Some checks are visual, some use the keyboard, some use measurement tools, and one uses other people. No single check is enough, because each one catches different failures.
| Check | Question it answers | Typical failure it catches |
|---|---|---|
| Squint test | Does it read as interactive? | Flat buttons that blend into the page |
| Grayscale test | Does it work without color? | Links distinguished only by hue |
| Contrast measurement | Is the text and boundary readable? | Light gray text, pale borders |
| Keyboard pass | Can I reach and see focus? | Missing or hidden focus outline |
| State pass | Do hover, active, disabled and loading differ? | States that look identical |
| Target measurement | Is it big enough to hit? | Tiny icon buttons, cramped link lists |
| Label review | Is it clear what happens next? | "Click here", "Submit", "More" |
| Task test with people | Do real users find it? | Everything you stopped noticing |
The order of checks
Run the cheap, fast checks first. Fix problems as they appear, then repeat the pass once, because fixing one thing (for example darkening a color) can change another (for example the hover contrast).
Check 1: The squint and grayscale tests
The squint test is the fastest check. Look at the page, then blur your eyes or step back from the screen. Buttons should still stand out as shapes. Links in body text should still look different from the words around them. If everything melts into one even texture, your cues are too weak.
The grayscale test removes color entirely. This simulates some forms of color vision deficiency and also shows whether your cues depend on hue alone. You can apply it temporarily to a page with a CSS filter, either in the developer tools or in a debug style sheet.
/* Debug only: remove before shipping */
html {
filter: grayscale(100%);
}In a grayscale page, check these points:
- Can you still pick out the links inside a paragraph? Underlines or other non-color cues should make them visible.
- Can you still tell the primary button from the secondary one? Fill versus outline should do this.
- Can you still see which element has focus?
Browser developer tools can also emulate vision deficiencies. In Chrome and Edge, open the Rendering panel and find "Emulate vision deficiencies". Firefox has a similar simulator in the Accessibility panel. Try protanopia, deuteranopia, and blurred vision.
Check 2: Measure contrast
Eyeballing contrast is unreliable, so measure it. The Web Content Accessibility Guidelines (WCAG) set these minimums that apply to clickable elements:
- Text, including button labels and link text, needs a contrast ratio of at least 4.5:1 against its background. Large text (about 24px, or 19px bold) needs 3:1.
- Parts of the interface needed to identify a control, such as the border of an outlined button, need at least 3:1 against the adjacent color. This is WCAG success criterion 1.4.11, Non-text Contrast.
- Focus indicators also need at least 3:1 against the surrounding colors.
Browser tools report the ratio for you. In Chrome, use the color picker in the Styles pane: it shows the ratio for text and flags whether it passes. Firefox's Accessibility inspector has a similar contrast readout. Lighthouse and the axe DevTools extension scan the whole page and list failures.
Check every state, not only the resting one. A button that passes at rest can fail on hover if the hover color is lighter, and a disabled-looking style can drop text below the threshold. Disabled controls are formally exempt from the contrast rules, but if you rely on aria-disabled and keep the control focusable, as in the earlier disabled-state chapter, users still need to read the label, so aim to keep it legible.
Also check the visited link color. A visited purple that looks fine on white can fail on a tinted background, and the visited color must still be distinguishable from surrounding text.
Check 3: The keyboard pass
Put your mouse aside and use only the keyboard. This pass tests focus indicators, order, and whether each control works.
- Press Tab from the top of the page. Each link and button should receive focus in a sensible order, normally the reading order.
- At each stop, confirm that a visible outline or other indicator appears. If you lose track of the focus, the indicator is missing or too faint.
- Press Enter on a link and a button. Both should activate.
- Press Space on a button. It should activate. Space does not activate a link.
- Press Shift+Tab to go backward and confirm the order mirrors the forward one.
If a <div> or <span> styled as a button never receives focus, it is not a real control. Replace it with a <button> or <a href>, as described in the chapter on choosing the right element.
You can find out which element has focus at any time from the console:
// Log the focused element each time focus moves
document.addEventListener('focusin', () => {
const el = document.activeElement;
console.log(el.tagName, el.textContent.trim().slice(0, 40));
});Paste this into the console, then press Tab through the page. It confirms the order and shows when focus lands on something unexpected, such as a hidden element.
Another common failure is outline: none with no replacement. Search your style sheets for it:
grep -rn "outline: *none\|outline: *0" src/cssEvery match should be paired with a custom :focus-visible style, or be removed.
Check 4: The state pass
Each state should be distinguishable from the others. Test them one at a time:
- Rest: it looks interactive on its own.
- Hover: something changes, such as background, underline thickness, or color.
- Focus: a clear outline appears, separate from hover.
- Active: a small press effect appears while the pointer is down.
- Visited (links): the color differs from unvisited links.
- Disabled: it looks unavailable and does not submit.
- Loading: it shows progress and does not allow a second submission.
You do not need to wait for real interactions. In Chrome DevTools, select an element, open the Styles pane, and click the :hov button. It lets you force :hover, :active, :focus, :focus-visible and :visited on the selected element. Then you can inspect each state calmly and measure its contrast.
Compare states in pairs. If hover and focus look the same, a keyboard user cannot tell the difference between "I am here" and "the mouse happens to be here". If the disabled and normal buttons differ only by a slight change in opacity, many people will not notice.
For the aria-disabled pattern from the earlier example, also verify behavior and not only looks. Click the button while it is marked disabled and confirm the form does not submit. Then change the attribute to false and confirm that it does.
<button type="submit" id="submit" aria-disabled="true">Create account</button>const button = document.getElementById('submit');
console.log(button.getAttribute('aria-disabled')); // "true"
button.setAttribute('aria-disabled', 'false');
console.log(button.getAttribute('aria-disabled')); // "false"Check 5: Measure target size
Hit areas are easy to get wrong because padding, line height and margins all affect them. Measure the rendered size instead of reading the CSS.
- WCAG 2.2 criterion 2.5.8 sets a minimum of 24 by 24 CSS pixels, with some exceptions for spacing and inline text.
- Stronger guidance, including the Level AAA criterion 2.5.5, recommends about 44 by 44 CSS pixels. That is why the button style in this tutorial uses
min-height: 44px.
In the browser, hover over an element in the Elements panel to see its box dimensions in a tooltip. You can also measure in script:
const targets = document.querySelectorAll('a, button');
targets.forEach((el) => {
const { width, height } = el.getBoundingClientRect();
if (width < 44 || height < 44) {
console.warn(
'Small target:',
el.tagName,
el.textContent.trim().slice(0, 30),
`${Math.round(width)}x${Math.round(height)}`
);
}
});Expect many inline links in paragraphs to be reported, because their height follows the line height. Inline text links are generally exempt from the size rule, so focus on standalone controls: icon buttons, toolbar buttons, pagination links, and items in navigation lists. For stacked links, check the gap between neighbors too, so a slightly missed tap does not hit the wrong target.
Then test on a real phone. A desktop browser's device mode shows layout, but it cannot tell you how your thumb feels on the screen. Try to tap every control one-handed while holding the phone as you normally would.
Check 6: Review labels
Read each button and link label without the surrounding text, the way a screen reader user hears a list of links. A label passes if it says what happens next.
| Weak label | Better label | Reason |
|---|---|---|
| Click here | Download the 2026 price list | Names the destination |
| Submit | Create account | Names the outcome |
| More | Read more about shipping | Gives context out of order |
| OK | Delete project | Repeats the action being confirmed |
Screen readers can list all links and buttons on a page. In NVDA, press Insert+F7. In VoiceOver on macOS, use the rotor (VO+U). If the list reads "Read more, Read more, Read more", the labels need context, either visible or added through aria-label.
Check 7: Test with people
Your own judgment is biased because you already know where everything is. A short test with a handful of people finds problems that checks cannot.
- Choose three or four tasks that require clicking, such as "find where to sign up" or "go to the pricing page".
- Give a person the task without telling them where to click.
- Watch where they hesitate, where they click on something that is not interactive, and what they overlook.
- Note every wrong click. A wrong click on plain text means that text looks like a link. A long search for a control means that control does not look clickable.
You do not need many participants. Even five people tend to reveal the biggest problems. A quick variant is the five-second test: show the page for five seconds, hide it, and ask the person to name what they could click.
Common mistakes in testing
- Testing only at rest. Failures often appear on hover, on focus, or in the visited state.
- Testing only with a mouse. Keyboard and touch expose most of the issues.
- Trusting a passing automated scan. Tools such as Lighthouse catch roughly a portion of problems. They cannot judge whether a label is meaningful or whether a flat button looks pressable.
- Checking one browser. Focus styles, default link colors and form control rendering differ across browsers, so run the keyboard pass in at least two.
- Leaving debug code in. Remove the grayscale filter and console scripts before shipping.
A reusable checklist
Copy this list and run it on any component:
- Squint test: does it stand out as interactive?
- Grayscale test: does it still work without color?
- Contrast: text at 4.5:1 or better, control boundaries and focus outlines at 3:1 or better, in every state.
- Keyboard: reachable with Tab, visible focus, activates with Enter (and Space for buttons).
- States: hover, focus, active, visited, disabled and loading each look different.
- Size: standalone targets are at least 24px, and ideally 44px, with space between neighbors.
- Labels: each one says what happens next, even when read out of context.
- People: at least a few users find the control without help.
Exercise
A teammate says a secondary outlined button "passes" because Lighthouse reported no contrast errors on the page at rest. Name three further checks you would run before agreeing, and what each would reveal.
Show answer
Any three of the following. (1) Force the hover, active and focus states with the :hov panel and measure contrast in each, because a hover color can fail even when the resting state passes. (2) Run a keyboard pass with Tab to confirm a visible focus outline of at least 3:1 contrast, since Lighthouse cannot confirm that the indicator is easy to see. (3) Measure the outline's border contrast against the page background, which must be at least 3:1 for non-text contrast. (4) Apply the grayscale test to confirm the secondary button still ranks below the primary one without color. (5) Measure the rendered size to confirm it meets the 24px minimum, and ideally 44px.
Exercise
You run the target-size script and it warns about 30 links inside paragraphs, plus two icon-only toolbar buttons measuring 28 by 28. Which warnings do you act on, and why?
Show answer
Act on the two toolbar buttons. Inline text links are generally exempt from the target size rule because their size follows the surrounding text. The toolbar buttons are standalone controls. They pass the 24px minimum but fall short of the recommended 44px, so increase their padding or minimum size, and check the spacing between them. Also give them an accessible name, since an icon-only button has no visible text label.
Exercise
During a keyboard pass, Tab skips a "Buy now" control that looks like a button. Inspecting it shows <div class="btn" onclick="buy()">Buy now</div>. What is wrong and how do you fix it?
Show answer
A div is not focusable and has no button role, so keyboard and screen reader users cannot reach or activate it. Replace it with <button type="button" class="btn">Buy now</button> and attach the click handler to that button (or use <a href> if it navigates). The native element supplies focus, Enter and Space activation, and the correct role without extra code.