Bird
0
0

Which of the following is the correct syntax to add an ARIA label to a button in Angular template?

easy📝 Syntax Q3 of 15
Angular - Internationalization and Accessibility
Which of the following is the correct syntax to add an ARIA label to a button in Angular template?
A<button aria_label="Close dialog">X</button>
B<button ariaLabel='Close dialog'>X</button>
C<button aria label="Close dialog">X</button>
D<button aria-label="Close dialog">X</button>
Step-by-Step Solution
Solution:
  1. Step 1: Recall ARIA attribute syntax

    ARIA attributes use hyphenated lowercase names like aria-label, not camelCase or underscores.
  2. Step 2: Check Angular template attribute usage

    Attributes are added as normal HTML attributes with quotes around values.
  3. Final Answer:

    <button aria-label="Close dialog">X</button> -> Option D
  4. Quick Check:

    ARIA attribute syntax = aria-label [OK]
Quick Trick: Use hyphenated aria-label, not camelCase or underscores [OK]
Common Mistakes:
  • Using ariaLabel instead of aria-label
  • Using underscores instead of hyphens
  • Adding spaces inside attribute names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes