Careeroza
Keyboard & Focus
Keyboard Navigation
Many users never touch a mouse. Everything must work with Tab (next), Shift+Tab (previous), Enter/Space (activate) and the arrow keys.
- Links, buttons and form fields are focusable automatically.
tabindex="0"makes a custom element focusable in normal order;tabindex="-1"lets scripts focus it without adding it to the Tab order.- Never use positive
tabindexvalues; they break the natural order.
Visible Focus and Skip Links
Example
Click inside the preview and press Tab: the focus outline shows where you are. The first link lets keyboard users skip the menu:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
a:focus-visible { outline: 3px solid #04AA6D; outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: #ffd; padding: 4px; }
</style>
</head>
<body>
<a href="#main" class="skip">Skip to main content</a>
<nav><a href="#">Home</a> <a href="#">Courses</a> <a href="#">Contact</a></nav>
<main id="main" tabindex="-1"><p>Main content.</p></main>
</body>
</html>Result
Note: Never remove focus outlines (outline: none) without providing a clear replacement.
Checklist
- Page has a
lang, a title, and a logical heading order. - All images have suitable
alttext; inputs have labels. - Text contrast is at least 4.5:1.
- Everything works with the keyboard, with a visible focus.
- Test with a screen reader (NVDA, VoiceOver) and Lighthouse / axe DevTools.