Skip to main content

Readable (Discernible) Button Text Issues: Correcting

There are a few ways to resolve a Buttons Must Have Discernible Text flag. Below are some options for fixing either a <button> element or an element with role="button" to pass this guideline. You will need to choose the option that works best for your page(s).

Add Inner Text to the Button

Perhaps the simplest way to fix this issue is to add inner text to the button.

Flagged: <button id="EnterStore" ></button>

Corrected: <button id="EnterStore">Enter Store</button>


Add an aria-label Attribute

If you have a location where a visible label would not be the best option for a button, consider adding a non-empty aria-label attribute to the button. This could be due to design considerations, or if the button's appearance makes its purpose clear, like a magnifying glass for a search button.

Flagged: <div id="box">
​ This is a pop-up box.
​ <button>X</button>
​ </div>

Corrected: <div id="box">
​ This is a pop-up box.
​ <button aria-label="Close">X</button>
​ </div>


Add an aria-labelledby Attribute or fix the Existing Attribute

The aria-labelledby property lets you leverage content already in use in a webpage by referring to its id.

An example:

​<p id="deleteBtnLabel">Delete your account</p>
​<button aria-labelledby="deleteBtnLabel"> <span aria-hidden="true">🗑️</span> </button>

If you already have an aria-labelledby property in your HTML for the button and still get this flag, double-check that the correct element id is being referenced in the aria-labelledby property.


Replace Decorative Buttons

If a button does nothing and is only there for looks, replace it with a non-interactive element, such as a <span>, so it isn't announced or focusable.

<span class="decorative-shape"></span>


Add a title Attribute

The title attribute can be added as a method to provide readable text for a button. The title attribute is readable by most screen readers, but an aria-label is preferred.

Flagged: <button id="EnterStore" ></button>

Corrected: <button id="EnterStore" title="Enter Store"></button>


Common Client Issue

<buttons> that use Icons

Many clients are flagged for their search or social media icons that are included in a <button>. This can be corrected by adding an aria-label attribute to the <button> tag.

Flagged:
​<button class="btn btn-primary" type="submit">
​ <i class="fa fa-search" aria-hidden="true"></i>
​</button>

Corrected:

<button class="btn btn-primary" aria-label="Search" type="submit">
​ <i class="fa fa-search" aria-hidden="true"></i>
​</button>

Adding the aria-label="Search" will resolve the flag in the above case.


Readable Input Button Text

Buttons used in forms also need readable (discernible) text to allow assistive technology users to understand the purpose of the button.

Flagged:
​<form action="#">

<input type="button" id="pass1" />

</form>

The input button above can be corrected by adding any of the following to the <input> tag:

  • value="ButtonName"

  • aria-label="ButtonName"

  • aria-labelledby="DivWithName"

  • title="ButtonName"

Inputs with type="submit" or type="reset" get a default name ("Submit" or "Reset") from the browser. To give them a clearer name, add a value attribute, such as value="Send Message".

Some correct input field examples:

<input type="button" value="Look Up User" />

<input type="submit" title="Submit" id="pass2" />

<input type="reset" title="Reset Form" id="pass3" />


Looking for Button Text basics? Review our Readable Button Text: The Basics article.

If you have questions, please contact our DubBot Support team via email at help@dubbot.com or via the blue chat bubble in the lower right corner of your screen. We are here to help!

Did this answer your question?