Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button with icon labelled with aria-label still an 'Empty Button' error

A button with an aria-label:

<button type="button" class="btn btn-default dropdown-toggle"
  aria-expanded="false"
  aria-label="Sort">
  <i class="fa fa-arrows"></i>
</button>

is still identified as an accessibility error ('Empty Button') by WAVE. Any ideas?

like image 727
Christine Avatar asked Jan 15 '16 22:01

Christine


People also ask

How do I fix an empty button error?

To fix an empty button error, you will need to find the button that is being flagged and add descriptive text to it. You will need to either: add text content within an empty <button> element, add a value attribute to an <input> that is missing one, or add alternative text to a button image.

Can aria labels be empty?

Empty aria-label should absolutely be avoided as it can cause screen readers to do unpredictable things.

Should icons have aria-label?

The [aria-label] text is read instead of any content inside the element, including otherwise accessible text. In addition to icons, it can be useful when the context of a link or button might be apparent to sighted users, but confusing for visually impaired users.

Does aria-label override button text?

aria-label allows us to specify a string to be used as the accessible label. This overrides any other native labeling mechanism, such as a label element — for example, if a button has both text content and an aria-label , only the aria-label value will be used.


1 Answers

Older screenreaders/browsers dont make use of ARIA. Using visually-hidden text is a more robust method, as in the link CBroe left in the comment above.

like image 122
stringy Avatar answered Sep 30 '22 00:09

stringy