5 concepts · 10 practice questions
Native elements come with a role, an accessible name and keyboard behaviour for free. A button is focusable, announced as a button and fires on Enter and Space; a div with a click handler is none of those. Use headings in order to give the page an outline, landmarks (header, nav, main, footer) for navigation, and a visible label tied to every input. A placeholder is not a label: it disappears as soon as the user types and is often low contrast.
<!-- Not this --> <div class="btn" onclick="save()">Save</div> <input placeholder="Email" /> <!-- This --> <button type="button" onclick="save()">Save</button> <label for="email">Email</label> <input id="email" type="email" autocomplete="email" />
Sign in to read the rest and take the 10-question test.
Sign in to continue