Bird
0
0

What is the main problem with this HTML snippet for accessibility?

medium📝 Debug Q7 of 15
Testing Fundamentals - Non-Functional Testing
What is the main problem with this HTML snippet for accessibility?
<input type='text' id='email'>
<label>Email</label>
AThe label text is missing
BThe label is not associated with the input
CThe input type is incorrect
DThe input is missing a placeholder
Step-by-Step Solution
Solution:
  1. Step 1: Check label and input association

    The label lacks a 'for' attribute linking it to the input's id, so screen readers can't associate them.
  2. Step 2: Verify other options

    Input type 'text' is correct for email (though email type exists), label text is present, placeholder is optional.
  3. Final Answer:

    The label is not associated with the input -> Option B
  4. Quick Check:

    Label must link to input via 'for' attribute [OK]
Quick Trick: Use label's for attribute matching input id for accessibility [OK]
Common Mistakes:
  • Omitting 'for' attribute on label
  • Assuming placeholder replaces label
  • Using wrong input type without reason

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes