Which methods are acceptable for adding alternative text to <canvas> elements?

Add text in the alt attribute

Add text via aria-label

Using aria-label to provide alternative text for <canvas> elements is a suitable method because it allows screen readers to understand and convey the purpose of the canvas content to visually impaired users. Unlike standard HTML elements, the <canvas> element does not support an alt attribute, making traditional methods of adding alternative text inadequate. By using aria-label, you directly associate descriptive text with the canvas, ensuring that users who rely on assistive technologies have the context needed to understand the content or function of the canvas.

Referring to text via aria-labelledby can also be an effective way to provide accessible context by linking the canvas to another element whose text serves as a label. However, the aria-label method is a more straightforward approach when you want to render a concise description directly associated with the canvas and does not depend on the presence of an additional element.

Providing text within the <canvas> element itself will generally not be accessible since content rendered inside the canvas becomes graphical, and is not exposed to screen readers in a meaningful way. Text in the alt attribute cannot be used with <canvas> as it is not a recognized approach for this element. Therefore, using aria-label stands out as the best choice for adding alternative text to ensure accessibility.

Refer to text via aria-labelledby

Provide text within the <canvas> element

Want more questions?

All options are one-time payments.

$12.99

30 day pass for new members

All the basics to get you started

  • Ad-free experience
  • View your previous attempt history
  • Mobile app access
  • In-depth explanations
  • 30 day premium pass access
$29.99$92.93 usd

6 month DELUXE pass (most popular)

Full access FOR 6 MONTHS! & the ultimate digital PDF study guide (BONUS)

  • $92.93 usd value for $29.99! You save $62.94!
  • Ad-free experience
  • View your previous attempt history
  • Mobile app access
  • In-depth explanations
  • 6 months of full access
  • Ultimate digital PDF study guide included
  • Priority support
$14.99 $19.99

Ultimate digital PDF study guide

For those that prefer a more traditional form of learning

  • Available for instant download
  • Available offline
  • Hundreds of practice multiple choice questions
  • Comprehensive content
  • Detailed explanations
Image Description
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy