0
0
HTMLmarkup~20 mins

Keyboard navigation basics in HTML - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Keyboard Navigation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Tabindex Attribute
Which of the following tabindex values makes an element focusable in the natural tab order of the page?
Atabindex="0"
Btabindex="-1"
Ctabindex="5"
Dtabindex="-5"
Attempts:
2 left
💡 Hint
Remember that tabindex="0" places the element in the natural tab order.
📝 Syntax
intermediate
2:00remaining
Correct Keyboard Event Attribute
Which HTML attribute correctly listens for a keyboard event when a user presses a key on an input element?
HTML
<input type="text" ____ >
Aonkeydown="handleKeyDown()"
Bonkeypress="handleKeyPress()"
Conkeyup="handleKeyUp()"
Donkeypressed="handleKeyPressed()"
Attempts:
2 left
💡 Hint
The event that fires when a key is first pressed down is the one to use.
rendering
advanced
2:00remaining
Visual Focus Indicator
Given the CSS below, what visual effect will a focused button have when navigated to by keyboard?
HTML
button:focus {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
  background-color: #e0f0ff;
}
AThe button will have no visible change when focused.
BThe button will have a thin red border inside its edges and a dark blue background.
CThe button will have a thick blue border outside its edges and a light blue background.
DThe button will have a dotted black border and a yellow background.
Attempts:
2 left
💡 Hint
Look at the outline color and offset values.
selector
advanced
2:00remaining
CSS Selector for Focused Interactive Elements
Which CSS selector correctly targets all interactive elements that are currently focused for keyboard navigation styling?
A:active
B:focus
C:focusable
D:hover
Attempts:
2 left
💡 Hint
This selector matches elements that have keyboard or mouse focus.
accessibility
expert
2:00remaining
ARIA Role for Keyboard Navigable Menu
Which ARIA role should you assign to a
HTML
<nav role="____">
  <!-- menu items -->
</nav>
Anavigation
Blist
Capplication
Dmenu
Attempts:
2 left
💡 Hint
This role explicitly tells assistive tech that the element is a menu with keyboard navigation.