Element

input

Error Type

Likely

Guidelines

Requirement

Image used in input element - Alt text should not be the same as the filename.

Error

Image used in input element - Suspicious Alt text (same as filename).

Short Description

input elements cannot have alt attribute values that are the same as their src attribute values.

How To Determine

Question Is this Alt text appropriate for the image?
PASS Alt text is appropriate for the image.
FAIL Alt text is not appropriate for the image.

Steps To Check

Procedure

1. Check all input elements that have a type attribute value of "image".
2. Check the alt attribute value of the input element.
3. Check the src attribute value of the input element.

Expected Result

1. The alt attribute value is expected to be different from the src attribute value.

Failed Result

1. Change the alt attribute value or confirm that the current alt attribute value is appropriate for the image.

Examples

Pass Examples

input alt attribute is different from the src attribute.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #61 - Negative</title>
</head>
<body>
<form>
<label for="name">Name</label>: <br/><br/><input type="image" name="name" id="name" src="input.jpg" alt="input name">
</form>
</body>
</html>

Fail Examples

input alt attribute is same as the src attribute.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #61 - Positive</title>
</head>
<body>
<form>
<label for="name">Name</label>: <br/><br/><input type="image" name="name" id="name" src="name.jpg" alt="name.jpg">
</form>
</body>
</html>
Web site engine's code is copyright © 2023
Inclusive Design Institute