Skip to main content
InterviewHubPRO
Section Overview
Q6

Question 6 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

12%
Web Accessibility & WCAG (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What is the difference between `aria-label`, `aria-labelledby`, and `aria-describedby`?

junior LevelCode ExampleaccessibilityBasic

In Simple Words:

  • aria-label="string": Provides an invisible text label directly in the attribute:
    html
    <button aria-label="Close dialog">X</button>
    
  • aria-labelledby="id": Points to an existing visible element in the DOM to serve as the label:
    html
    <h2 id="modal-title">Delete Account</h2>
    <div role="dialog" aria-labelledby="modal-title">...</div>
    
  • aria-describedby="id": Provides secondary supplementary description or error messages (read by screen readers after the label):
    html
    <input type="password" id="pwd" aria-describedby="pwd-rules" />
    <span id="pwd-rules">Must contain at least 8 characters and 1 symbol.</span>