Skip to content

What is the difference between aria-labels and alt-text? #252

Answered by mgifford
mikang asked this question in Q&A
Discussion options

You must be logged in to vote

Short answer: alt-text can be used only with images, while aria-labels can be applied to pretty much everything. Only use aria-labels on images if for some reason you can't use alt-text.

And No, all elements shouldn't be using aria-labels.

Longer answer: Page elements should only have aria-labels associated with them if for whatever reason you cannot provide the equivalent semantics with HTML. The first rule of ARIA is not to use ARIA.

If you can't do:

<button class="favorite styled"
       type="button">
   Add to favorites
</button>

You could do something like this:
<div role="button" aria-label="Add to favorites">

But why not just stick to the classic form which will be more accessibl…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by dmundra
Comment options

You must be logged in to vote
3 replies
@mikang
Comment options

@dmundra
Comment options

@mikang
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants