I'm putting together a list of pros and cons about making the alt attribute required in HTML 5. The following is a list of reasons for and against making the alt attribute required. What is your opinion?

Author: Gez Lemon

Reasons why the alt Attribute Should Be Required

Reasons why the alt Attribute Should Not Be Required

What do you Think?

Do you have reasons other than those already stated about whether or not the alt attribute should be required in HTML 5? If so, either leave a comment here, or contribute to the Twitter discussion or respond to me directly on Twitter. If you respond on Twitter, please use the #althtml5 hashtag so that I can find your response.

Category: Accessibility.


  1. [requiring-alt-attribute-html5.php#comment1]

    Additional (in my opinion important) reason against requiring it on the format syntax level: If the consensus is that authoring tools should behave like Dreamweaver (i.e. omit alt if the user didn't supply it), ATAG 2.0 should guide authoring tools to do this. However, it would be unreasonable to guide authoring tools to let a user action violate the syntax of the underlying data format. Therefore, the syntax of the data format should allow such ATAG 2.0 guidance to be followed (i.e. make the result of following such guidance conforming).

    Posted by Henri Sivonen on

  2. [requiring-alt-attribute-html5.php#comment3]

    I agree on both sides. Requiring alt text and getting it right requires a standards-aware author, but in most cases the authors are some unaware people in some company using some random RichText editor.

    Making it mandatory won't make any difference to those people and their content will remain the same.

    Both ways appear to have a dead end. But for me as a web developer, I would like it to be not required for decorative images (I try to avoid it but sometimes you just have to), there is nothing worse than to hear bg_container_arrow.gif. By omitting alt text it would become invisibile for assistive technologies which (in this case) would be appreciated.

    What consequences this could have had, I don't know.

    Posted by Ollie on

  3. [requiring-alt-attribute-html5.php#comment5]

    Laura, obviously, authoring tools should have UI for entering a text alternative, since that's a requirement for being able to author WCAG 2.0-compliant content.

    The question is, what ATAG 2.0 should advice authoring tools to do when the user of the tool doesn't provide a text alternative (for whatever reason). At that point, the result won't be conforming to WCAG 2.0 no matter what the advice in ATAG 2.0. (Provided that the advice is reasonable - i.e. doesn't advise the tool not to output a document at all.) However, the result must be made conforming to HTML5. Otherwise, an authoring tool couldn't conform to both ATAG 2.0 and HTML5, which would be bad. (An HTML5 authoring tool MUST NOT emit documents that do not conform to HTML5.)

    Posted by Henri Sivonen on

  4. [requiring-alt-attribute-html5.php#comment6]

    Hi Henri,

    The question is, "Should the alt attribute be required in HTML5?"

    Dreamweaver doesn't output the alt attribute if one hasn't been provided, which is the right thing to do. Authoring tools shouldn't supply null or phony alt text on behalf of the author. The author should make a conscious decision. Yes, tools should help authors do this according to ATAG.

    The difference in opinion is that most people who want no alt to be valid in HTML5 only consider the tool perspective. This ignores the author and more importantly the user. The HTML5 priority of constituencies design principle comes into play here.

    Without alternative text, structure is incomplete because it cannot be perceived by some users. It should therefore be invalid. But all of this had been said before:

    Posted by Laura on

  5. [requiring-alt-attribute-html5.php#comment7]

    Without alternative text, structure is incomplete because it cannot be perceived by some users. It should therefore be invalid. But all of this had been said before:

    Until such time that the WHAT WG starts placing USERS needs over authors needs and browser-developers needs, (and validator needs) they will argue this to the death. Their perspective is limited by their lack of real understanding of what it is like to be dependent on Adaptive Technology. Oh they try, and they come up with some real gems and some real stinkers too (I recall long ago a snide comment regarding smell-o-vision

    It should be real simple - if there is value in posting an image on a page beyond "decoration" it must have a non-visual alternative - FULL STOP.

    An HTML5 authoring tool MUST NOT emit documents that do not conform to HTML5.
    - Henri Sivonen

    How about an HTML5 authoring tool MUST NOT emit documents that do not conform to *any* W3C standard related to said authoring - this would by default include WCAG2. (But where is the business model there?)

    Posted by John Foliot on

  6. [requiring-alt-attribute-html5.php#comment8]

    I see the question of this article as «What are the reasons for always requiring ALT, regardless of how badly it is used?» In addtion to above answers, I would add:

    * There has to be a benefit. Such as backward compatibility with old UAs.
    * A very simple author rule. (Tricky side: "how to discern between empty alt and no-alt-text-found-as-of-yet?")

    * @Gees, @Laura: Would not a "incomplete data structure" become repaired, if the lacking @alt became repaired? (Repair is usually inferious from "made right, from the start").
    * Is it possible for the user to discern between "reapaired content" and "real alt text"?
    * Forcing users to enter alt text is merely an authoring procedure requirement, but not a @alt requirement. It could just as well be an argued that, following such a procedure, the @alt should be dropped for empty alt content. (If we look at this argument alone.)
    * 'Significant content' in the form of no-alt is in fact "hidden metadata".
    * What else does "significant content" mean than "do not ignore this IMG"?

    * The line in the article which says that an additional attributes should be included (@role, I guess) in order to tell when "it hasn't been provided" perhaps refers to something I uttered. In that case, what I meant to say was that @role could serve as an indicator for of the *content* of @alt. In some cases, e.g. role="deocrative", role could be used to repair non-empty text. Also, if role said role="photo", then "photo" could be used as *alt text repair*, both when @alt is lacking and when alt is empty.

    Posted by Leif Halvard Silli on

  7. [requiring-alt-attribute-html5.php#comment9]

    * The crown argument for not making @alt an obligatory attribute always, regardless, seems to be that it is then possible to attribute meaning to the lack-of-alt. This very point seems to escape those that only argue from the POW of what (perhaps) does(n't) happen in the UA.

    * In order to make the point that there is no semantics in the lack-of-alt. Lack-of-alt and empty alt are equal. Of course, in reality one could say that since lack-of-alt and empty alt are equal, @alt could be skipped. True. If so, then we only have the "best practise" reason for for always including at least the emtpy alt.
    * When we are able to say that empty alt and lack-of-alt are equal, then we can make the derived argument that we need something else to signify "significant content", namely we need @role.

    Posted by Leif Halvard Silli on

  8. [requiring-alt-attribute-html5.php#comment10]

    How about an HTML5 authoring tool MUST NOT emit documents that do not conform to *any* W3C standard related to said authoring - this would by default include WCAG2.

    That makes a righteous soundbyte, but the problem is that ensuring conformance is WCAG2 is not something that can be programmed while offering the kind of feature set that people expect of authoring tools (including the feature of inserting an image).

    Posted by Henri Sivonen on

  9. [requiring-alt-attribute-html5.php#comment11]

    Thank you to everyone that has provided an opinion either in these comments or on Twitter.

    Just a reminder that the purpose of this post is to collect opinions about whether or not the alt attribute should be required for the img element. Henri's is one of the most convincing arguments put forward so far against the alt attribute being required, and I wouldn't want to discourage people who feel strongly either side of the debate from contributing.

    Contributions expressing an opinion for or against requiring the alt attribute for the img element are welcome.

    Posted by Gez Lemon on

  10. [requiring-alt-attribute-html5.php#comment12]

    Arguing that because some authoring tool / CMS does not require / prompt one to enter alt text is "evidence" that alt is not required is quite weak. It is the limitation of the authoring tool and it does not comply with ATAG. So many authoring tools / user agents do not do what the ATAG / UAAG says. That does not mean what is in ATAG / UAAG is wrong and baseless.

    Graphics do serve a purpose for navigation for blind users. Sometimes sighted colleagues refer to some content being close/ next to some image and am able to navigate to it. Some forms have an image link for the submit button. When I know this (for a page I am familiar with), navigating by image is one way of quickly going to the submit "button".

    But you cannot expect screen reader users to navigate by images like one attempts to navigate by headings all the time.

    Sometimes the alt is the same as the text / link next to the img. And at most times the image depicts much more than what the adjacent text says. While testing for accessibility, I highlight this for review. The alt then is changed to something that is more appropriate in the context. If indeed it is the same as the text already present, the alt is set to null. For image links, (i) alt can be null or (ii) contain text if anchor text is absent or (iii) can contain useful text that is in addition to anchor text.

    Screen readers can be set to disregard images with no alt based on the image dimension. This is a fix by AT makers to accommodate pages with images that do not have the mandatory alt as per current specs. Maybe images with width or height less than 25 (or 10 or whatever) are usually decorative and can be ignored goes the logic so long as they are not in an anchor.

    But these days you have images styled as buttons with JS script attached that makes them into a UI component that can be activated only with a mouse. If these are say less than 25 in height/width and have no alt, not only will they be not keyboard operable but not even perceivable to chaps like me.

    When my children download photos from a camera into a folder, they painstakingly label them (briefly) eg. FamilyAtXmasTree.jpg, or MomDad.jpg, LighthouseAtVABeach.jpg etc. This helps me to identify pics and email them to someone or upload them etc. It matters to them so they care to do it.

    Alt is an attribute that has been in the specs for a long time with its purpose and requirement clearly spelt out. A validator should flag an error if alt is missing. An accessibility tester will still have to check if alt is appropriate or not. A pie chart can have just a short text to identify it with no other details if the text content already contains adequate description for the image.

    I simply think people are taking this debate too far and spending too much time and energies on this issue. Regardless of what you decide, there will be thousands of images that need alt text out there and do not have them and thousands of authors who will not care about assigning alt and thousands of authors who will consciously define alt text.

    It offers the author the ability to define alt text if he chooses to. Introduce other elements / attributes (figure tag, legend, caption, etc) but do not disregard backward compatibility with old specs and existing Web content. So retain the alt as is.

    Posted by Sailesh Panchang on

  11. [requiring-alt-attribute-html5.php#comment14]

    Thanks to Sailesh for bringing a practical real-world perspective to this issue. I agree the alt attribute should be required in HTML 5.

    We all rejoice in the web as a communication medium that can bring information and services to people around the world, so let us not forget that for physical or technological reasons, some of those users are unable to see images. Sometimes the lack of appropriate text alternatives for images can render a site inaccessible to some people.

    The web is the medium, HTML a language, and tools are tools. Of course some developers may not be able or willing to fully use the potential of the language and some tools may not be up to the task but I don't see why this justifies debasing the web's inclusive world-wide goals.

    To move away from a situation that explicitly requires the language of the web to be non-discriminatory, to one where the language of the web suggests that non-discrimination is an optional extra, would be in my opinion a backward step.

    Posted by Roger Hudson on

  12. [requiring-alt-attribute-html5.php#comment15]


    I simply think people are taking this debate too far and spending too much time and energies on this issue.

    Very true.

    The fact is that there are times when it is appropriate for an image not to have alternative text content (e.g. if the content is exactly replicated in text already). Whether this is achieved through a null alt attribute or omitting the alt attribute is not important as long as user agents interpret this correctly (i.e. as deliberate omission and don't try to add value by reading file names).

    Neither proposal can offer a solution to the misuse of alt attributes. If it is required then it can still be left null when it should have content, or duplicate existing content when none is required. If it is not required then it can be left out when it should be there, left null when it should have content, contain duplicate content when it need not have any.

    In summary, either proposal will still require web content generators to show thought and judgement in supplying alternative text so I don't see that it makes a great deal of difference.

    One decent argument (that I don't think I've seen yet) for alt not being a required attribute is that it seems inefficient (in programming terms) to include code to describe something which is not there. It is usual to assume omission means that something is not required or that a default value should be used (in this case null). Allowing omission of the alt attribute could reduce file sizes (albeit slightly) and thus speed up page load times and reduce bandwidth costs.

    Posted by Phil Spencer on

  13. [requiring-alt-attribute-html5.php#comment16]

    Phil Spencer sums this up perfectly - either way, you essentially end up with the same situation since 'alt=""' remains valid. Unless some of you are talking about requiring a non-null value which means 'alt=" "' is valid; reductio ad absurdum.

    We cannot enforce ALL aspects of the WCAG through syntax checking alone. At some point, education, changes in mindset, or legislation are required.

    Posted by Five Minute Argument on

  14. [requiring-alt-attribute-html5.php#comment18]

    require the alt

    make tools ask for it

    have the tools auto fill if the editor doesn't provide an alt

    code without alts won't pass validation, but agents should progress without alt

    Posted by dean on

  15. [requiring-alt-attribute-html5.php#comment19]

    I vote for the first suggestion:

    "If the image is decorative, it should be provided with CSS. If the image has content, then the alt attribute should be used or the content will not be perceivable to some users."

    This puts the responsibility on the author to add the correct code if they have something to say that needs to be said inside an image. In this suggestion the screen reader ignores "null" ALTs and IMGs when the ALT is missing.

    Posted by john brandt on

  16. [requiring-alt-attribute-html5.php#comment20]

    This seems like a distraction from the very excellent list of options.

    Reducing the situation to "require alt/don't require alt" ignores the variety of middle ground options that would actually solve the concerns of everyone. (except the lazy people, and we can't write their code for them so they'll just have to deal with it)

    Posted by Dave on

Comments are closed for this entry.