At the glass door of a convenience store, you pull the handle, the door doesn't move, and only then you realise it needs a push. A door with a long handle seems to say "pull", and a door with a flat plate seems to say "push". Put a handle on a push door, and people pull it first, fail, then push. The door isn't broken. Its signal is lying.
Screens are full of lying signals like the handle on a push door: an active button that looks disabled, a coloured box that turns out to be only information. The idea behind all this is affordance: what someone can do with an object. In UI it means: an element you can click should look clickable, and one you can't click shouldn't look like a button.
Affordance and signifier
Don Norman, in his book The Design of Everyday Things, separates two things:
- Affordance: the action that's actually possible. A button can be pressed, an input (a field to fill in) can be typed into.
- Signifier: the signal that tells you where and how to act. For example a button's shape, a link's underline, and the box around an input. On the doors above, the handle and the flat plate are signifiers.
On a screen everything is technically clickable, even when nothing happens. So what we really design are the signifiers. In everyday talk the two words are used interchangeably, and "clear affordance" means a clear signifier.
Signals at rest, and signals that confirm
There are two kinds of signal:
- Visible at rest (before anything is touched): a button shape with a background, a border and rounded corners; the accent colour (a strong colour that draws attention); an underline on a link; a box around an input. This is what people read before they decide to click.
- Confirming (once touched):
cursor: pointer(the mouse cursor turns into a hand), a colour change on hover (when the mouse is over the element, only with a mouse), a focus ring when the element is picked with the Tab key on a keyboard, and a change while pressed.
Phones have no cursor and no hover. So the signals visible at rest have to be enough on their own. The cursor and hover only confirm.
Here are the buttons on Mrs. Sri's page with both kinds of signal. .nights holds the three night buttons, .checkin is the check-in date, and .book is the book button:
<div class="nights">
<button aria-pressed="false">1 night</button>
<button aria-pressed="true">2 nights</button>
<button aria-pressed="false">3 nights</button>
</div>
<p class="checkin">Check-in 12 Dec</p>
<button class="book">Book the room, pay on arrival</button>
<style>
.nights button, .book { font: inherit; border-radius: 0.375rem; cursor: pointer; }
.nights button { padding: 0.5rem 1rem; color: #1f2937; background: #fff; border: 1px solid #475569; }
.nights button[aria-pressed="true"] { color: white; background: #15803d; border-color: #15803d; }
.book { padding: 0.75rem 1rem; color: white; background-color: #15803d; border: none; }
.nights button:hover { border-color: #15803d; }
.book:hover { background-color: #166534; }
.nights button:focus-visible, .book:focus-visible { outline: 3px solid #1f2937; outline-offset: 2px; }
.checkin { color: #475569; } /* information: no box, no accent colour */
</style>
- The night buttons have a border, padding and rounded
0.375remcorners (fromborder-radius): a button shape you can read without touching it. The chosen button is filled green and marked witharia-pressed="true", which tells screen readers (programs that read pages aloud for blind users) that the button is chosen. - The book button is filled with green
#15803d, the page's only accent colour, with white (white) text. cursor: pointerand:hoverconfirm with a mouse.:focus-visibledraws a ring you can see when the button is picked with Tab..checkinis plain on purpose: grey, no box, because it can't be clicked.
In the exercise, the button says "Save changes", with blue #2563EB as its background-color (the background colour). The pattern is the same: a coloured background, white text, border-radius: 0.375rem and cursor: pointer.
The right element: button for actions, a for moving to another page
Use <button> for actions (choosing nights, sending the booking, saving) and <a href> (the link tag) for moving to another page ("Getting to Mist Homestay", Mrs. Sri's WhatsApp). <button> gives you a lot without extra code. It can be reached with Tab and pressed with Enter and Space, and screen readers announce it as a "button". A <div> or <span> with a click event (code that runs when the element is clicked) has none of those things. It needs role="button", tabindex="0" and code for the keyboard keys. Using <button> from the start is easier.
The test: what a new user tries to click
On the first version of Mrs. Sri's page, the choices "1 night · 2 nights · 3 nights" were written as plain grey text, even though they can be clicked. "Check-in 12 Dec" was drawn as a rounded green box, even though it's only information. Take a guess: which one will a first-time guest tap?
Mrs. Sri's team asked Mr. Hadi (58 years old), who had never opened the page, to book the Terrace Room for 2 nights. Then they only watched. On the first version of the page:
| Element | Looks clickable? | Is clickable? | What happened |
|---|---|---|---|
| Grey text "1 night · 2 nights · 3 nights" | No | Yes | Skipped. Mr. Hadi didn't know he could choose the nights |
| Green box "Check-in 12 Dec" | Yes | No | Tapped twice, nothing happened |
| Green "Book the room" button | Yes | Yes | Pressed, it worked |
The first two rows of the table are two affordance failures: hidden (clickable but doesn't look it) and false (looks clickable but isn't). So a new guest tries to tap the date box, and skips the night choices. The fix is in the code above: the night choices get a button shape, and the date goes back to plain text.
You can try this test yourself without the Lab. Show your page to one person who has never seen it, and ask them to point at everything they think is clickable. Then compare that with what really is clickable.
⚠️ Signals that lie, or aren't there at all
- A
<div>or<span>as a button. It can't be reached with Tab or pressed with Enter. Use<button>. - Relying on hover. A card that only changes its shadow and cursor on hover gives no signal at all on a phone. Add a signal visible at rest: an arrow icon, "See details" text, or a clear border.
- Coloured boxes for information. People will tap labels, dates or statuses shaped like buttons.
- Links that differ only by colour. WCAG 1.4.1 asks that colour isn't the only difference, because people with colour blindness may not see it. In the middle of a paragraph, an underline is the simplest way to meet that rule.
outline: nonewith no replacement. This rule removes the focus ring, so keyboard users lose track of where the focus is.
TL;DR: Affordance means an element looks like what it does: what's clickable looks clickable, and what isn't doesn't look like a button. The signals (signifiers, Don Norman's term) come in two kinds. Visible at rest: background, border, rounded corners, accent colour, underline. Confirming: cursor: pointer, hover (when the mouse is over it), and :focus-visible (a ring when picked with Tab). Phones have no hover, so the signals at rest must be enough on their own. Use <button> for actions and <a> (a link) for navigation (moving to another page), not <div> or <span>. Test affordance with a new user: clickable but skipped is a hidden affordance, tapped but not clickable is a false affordance.
⚡ Signals at rest must be enough
Write:
.nights button, .book { font: inherit; border-radius: 0.375rem; cursor: pointer; }
.book { padding: 0.75rem 1rem; color: white; background-color: #15803d; border: none; }
.book:hover { background-color: #166534; }
.checkin { color: #475569; } /* information: no box, no accent colour */
Guess first: a card has a soft shadow, and its cursor turns into a hand (a pointer) when the mouse is over it (hover). It has no colour or icon. Is that enough to say "clickable"?
No, the sign that the card can be clicked is too subtle. Phones have no cursor and no hover, so on a phone that card gives no signal at all.
Meaning: Affordance means an element looks like what it does. In this code, .nights button is a night button and .book is the book button. Background, border, rounded corners, accent colour and underline are seen before anything is touched. cursor: pointer, hover and :focus-visible (a ring when picked with Tab) only confirm. What can't be clicked, like .checkin (the check-in date), shouldn't be shaped like a button.
⚡ button for actions, a for moving
Meaning: <button> is for actions, <a href> (a link) for moving to another page. A <button> can be reached with Tab, pressed with Enter and Space, and is announced as a "button" by screen readers (programs that read pages aloud for blind users) right away. A <div> with a click event (code that runs when the element is clicked) gets none of that.
⚡ Test with someone new
Guess first: the night choices are plain grey text, the check-in date is a rounded green box. Which one does a new guest tap?
The date box, which is only information. The night choices get skipped, even though they can be clicked.
Meaning: An element that is clickable but skipped is a hidden affordance. An element that is tapped but not clickable is a false affordance. To test for them, ask one person to point at everything they think is clickable, then compare that with what really is clickable.