Keyboard accessibility is helpful for users who rely on or prefer using a keyboard. Make sure to provide keyboard functionality to all interactive content. Common keyboard interactions include using the
tab key to select different interactive elements on a page and using the
enter key or the
spacebar to activate an in-focus element.
tab key navigates through all interactive elements on a page in the order they appear in the HTML document. A default visual indicator is provided by the web browser in use. The display is a border around the focused element. When an element is in focus, it can be further activated using the keyboard.
The order in which interactive elements receive focus should be logical and predictable. Create the tab flow hierarchy by using the source code to arrange the keyboard navigation. A common flow might begin with the header, followed by the main navigation, then content navigation (from left to right, top to bottom), and end with the footer. Try to give all your users the same experience.
Use natively-accessible elements in navigation to activate links, buttons, and form controls with a keyboard. Reinforce semantic HTML to convey intent and meaning instead of solely defining the look and feel of an element. Enhance with ARIA (Accessible Rich Internet Application) labels when necessary.
Communicate to screen-reader users the different areas of the screen and what they do with landmarks and by using appropriate HTML5 labels. Screen reader users can then quickly jump to any area they want.