Keyboard navigation allows users to move through a webpage using only the keyboard, typically with keys like Tab, Shift+Tab, Enter, and arrow keys.
Click to reveal answer
beginner
Which key is commonly used to move focus to the next interactive element on a webpage?
The Tab key moves the keyboard focus to the next interactive element, such as links, buttons, and form fields.
Click to reveal answer
intermediate
What attribute helps control the order of keyboard focus on elements?
The tabindex attribute controls the order in which elements receive keyboard focus. Positive values set custom order, 0 follows natural order, and -1 removes from tab order.
Click to reveal answer
beginner
Why is keyboard navigation important for accessibility?
Keyboard navigation is essential for users who cannot use a mouse, such as people with motor disabilities or those who rely on screen readers. It ensures everyone can access and use the website.
Click to reveal answer
intermediate
How can you make a non-interactive element focusable by keyboard?
Add tabindex="0" to the element. This includes it in the natural tab order so users can reach it with the keyboard.
Click to reveal answer
Which key moves focus backward to the previous interactive element?
ATab
BSpace
CEnter
DShift + Tab
✗ Incorrect
Holding Shift while pressing Tab moves the focus backward to the previous interactive element.
What does tabindex="-1" do to an element?
AMakes it focusable in tab order
BRemoves it from keyboard tab order but allows focus programmatically
CSets it as the first element to focus
DDisables the element
✗ Incorrect
tabindex="-1" removes the element from the tab order but it can still be focused using scripts.
Which HTML elements are naturally focusable by keyboard by default?
A<div> and <span>
B<header> and <footer>
C<button> and <a href>
D<p> and <section>
✗ Incorrect
Buttons and links with href attributes are naturally focusable by keyboard.
Why should you avoid using positive tabindex values to reorder focus?
AIt can confuse keyboard users and cause inconsistent navigation
BIt disables keyboard navigation
CIt improves accessibility
DIt makes elements invisible
✗ Incorrect
Using positive tabindex values can create confusing and unpredictable keyboard navigation order.
Which key typically activates a focused button or link?
AEnter
BEscape
CTab
DArrow keys
✗ Incorrect
Pressing Enter activates the focused button or link.
Explain how keyboard navigation works on a webpage and why it is important.
Think about how you move through links and buttons without a mouse.
You got /4 concepts.
Describe how the tabindex attribute affects keyboard navigation and give examples of its values.
Consider how you can control which elements get keyboard focus and in what order.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of keyboard navigation on a webpage?
easy
A. To allow users to move through the page using only the keyboard
B. To enable mouse clicks on buttons
C. To change the page colors automatically
D. To load images faster
Solution
Step 1: Understand keyboard navigation concept
Keyboard navigation means using keys like Tab to move focus between elements without a mouse.
Step 2: Identify the purpose
This helps users who cannot or prefer not to use a mouse to access all parts of a webpage.
Final Answer:
To allow users to move through the page using only the keyboard -> Option A
Quick Check:
Keyboard navigation = move with keyboard only [OK]
Hint: Keyboard navigation means moving focus without a mouse [OK]
Common Mistakes:
Confusing keyboard navigation with mouse actions
Thinking it changes page colors
Assuming it speeds up loading
2. Which HTML attribute is used to control the order of keyboard focus on elements?
easy
A. onclick
B. alt
C. href
D. tabindex
Solution
Step 1: Recall HTML attributes related to focus
The tabindex attribute sets the order in which elements receive keyboard focus.
Step 2: Eliminate unrelated attributes
onclick is for mouse clicks, alt is for images, href is for links.
Final Answer:
tabindex -> Option D
Quick Check:
Focus order attribute = tabindex [OK]
Hint: Use tabindex to set keyboard focus order [OK]
When pressing Tab repeatedly, which element will receive focus second?
medium
A. The <div> with tabindex="0"
B. The <button> element
C. The <a> link element
D. No element will receive focus second
Solution
Step 1: Understand default tab order
By default, focus moves to interactive elements like buttons and links in source order.
Step 2: Consider tabindex="0" effect
Adding tabindex="0" makes the <div> focusable and places it in the natural tab order after the button.
Final Answer:
The <div> with tabindex="0" -> Option A
Quick Check:
tabindex="0" adds element to tab order [OK]
Hint: tabindex="0" makes non-focusable elements focusable [OK]
Common Mistakes:
Assuming div cannot get focus
Thinking link comes second instead of div
Ignoring tabindex effect
4. This HTML code is intended to make a <div> focusable for keyboard users:
<div tabindex="-1">Menu</div>
Why might this cause a problem for keyboard navigation?
medium
A. tabindex='-1' makes the element invisible
B. tabindex='-1' removes the element from tab order, so it can't be reached by Tab key
C. tabindex='-1' causes a syntax error in HTML
D. tabindex='-1' makes the element focusable twice
Solution
Step 1: Understand tabindex="-1" meaning
tabindex="-1" makes an element focusable only by script, not by keyboard Tab key.
Step 2: Identify keyboard navigation impact
Because it is skipped in tab order, keyboard users cannot reach it by pressing Tab.
Final Answer:
tabindex='-1' removes the element from tab order, so it can't be reached by Tab key -> Option B
Quick Check:
tabindex="-1" excludes element from Tab focus [OK]
Hint: tabindex="-1" excludes element from keyboard tab focus [OK]
Common Mistakes:
Thinking tabindex="-1" causes syntax error
Believing it makes element invisible
Assuming it makes element focusable twice
5. You want to create a custom interactive widget using a <div> that keyboard users can access in a logical order after a button and a link. Which is the best way to ensure correct keyboard navigation?
hard
A. Add tabindex="-1" to the <div> so it is skipped by keyboard
B. Add tabindex="1" to the <div> to place it first in tab order
C. Add tabindex="0" to the <div> and place it after the button and link in HTML
D. Do not add tabindex; keyboard users cannot access <div> anyway
Solution
Step 1: Understand tabindex values and order
tabindex="0" places element in natural tab order based on HTML position; positive tabindex values change order but can confuse users.
Step 2: Choose best practice for accessibility
Using tabindex="0" and placing the <div> after button and link in HTML ensures logical, predictable keyboard navigation.
Final Answer:
Add tabindex="0" to the <div> and place it after the button and link in HTML -> Option C
Quick Check:
tabindex="0" + correct HTML order = best keyboard navigation [OK]
Hint: Use tabindex="0" and HTML order for logical tab sequence [OK]
Common Mistakes:
Using positive tabindex values which confuse tab order
Using tabindex="-1" which skips element
Assuming div is never focusable without tabindex
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.