Input buttons must have discernible text
How to Fix the Problem
Correct markup solutions
Eleven markup patterns pass the input-button-name
test
criteria:
<form action="#">
<input type="button" id="pass1" value="Button Name" />
<input type="button" id="pass2" aria-label="Name" />
<input type="button" id="pass3" aria-labelledby="labeldiv" />
<input type="button" id="pass4" value="Name" aria-label="Aria Name" />
<input type="submit" id="pass5" />
<input type="submit" value="Something" id="pass6" />
<input type="reset" id="pass7" />
<input type="reset" value="Something" id="pass8" />
<input type="button" title="Something" id="pass9" />
<input type="submit" title="Something" id="pass10" />
<input type="reset" title="Something" id="pass11" />
</form>
Incorrect markup solutions
Five markup patterns fail the input-button-name
test criteria:
<form action="#">
<input type="button" id="fail1" />
</form>
<form action="#">
<input type="button" id="fail2" aria-label="" />
</form>
<form action="#">
<input type="button" id="fail3" aria-labelledby="nonexistent" />
</form>
<form action="#">
<input type="button" id="fail4" aria-labelledby="emptydiv" />
<div id="labeldiv">Button label</div>
<div id="emptydiv"></div>
</form>
<form action="#">
<input type="submit" value="" id="fail5" />
</form>
<form action="#">
<input type="reset" value="" id="fail6" />
</form>
Why it Matters
Screen reader users are not able to discern the purpose of an
input type="button"
without an accessible name.
Screen reader users cannot understand the purpose of an image without a discernable and accessible textual name. A title for an image may provide only advisory information about the image itself. Unnamed actionable graphic images such as buttons have no clear description of the destination, purpose, function or action for the non-text content when it is intended to be used as a control.
Rule Description
Ensures input buttons have discernible text.
The input-button-name
rule separates functionality from the
button-name
rule to ensure that input buttons have discernible
text; advise relevant to input button names was incorrect for button elements.
The Algorithm (in simple terms)
Input buttons must have discernible text.
"; if (!!window.MSInputMethodContext && !!document.documentMode ) document.getElementById("form_message").innerHTML = checkMark + msg + "
"; else document.getElementById("form_message").innerHTML = checkMarkAnimation + msg + "
"; } if(type === "warning" ) { document.getElementById("form_message").style.color = "#916216"; document.getElementById("form_message").innerHTML = warningIcon + msg + "
"; } if(type === "error" ) { document.getElementById("form_message").style.color = "#b40909"; document.getElementById("form_message").innerHTML = errorIcon + msg + "
"; } document.getElementById("form_message").tabIndex = -1; document.getElementById("form_message").focus(); } function clearMessage() { document.getElementById("form_message").innerHTML = ""; } function showFeedbackForm() { document.getElementById("feedback-form").className = ""; document.getElementById("feedback-info").className = "deque-hidden"; document.getElementById("yesButton").focus(); setTimeout((function (){ document.getElementById("yesButton").focus(); }), 5000); } function hideFeedbackForm() { if( feedbackData ) { document.getElementById("feedback-info").className = ""; showMessage("You have cancelled editing your earlier feedback.", "warning"); } document.getElementById("feedback-form").className = "deque-hidden"; document.getElementById("yesButton").style.display = ""; document.getElementById("noButton").style.display = ""; document.getElementById("noFeedback").className = "deque-hidden"; setTimeout((function() { clearMessage(); }), 4000); }