I'd rather have the 'alt' and 'title' fields be blank than set to the file name as a default. Using the file name for these values is not a good idea, and it's tiresome to have to erase the defaults for every image that is uploaded.
| Comment | File | Size | Author |
|---|---|---|---|
| image_fupload-HEAD_title_alt_defaults.patch | 952 bytes | dboulet |
Comments
Comment #1
grandcat commentedDon't think so. It's not a good idea to keep the alt and title field empty because they often won't be filled. Unfortunately, all browsers don't like this.
Comment #2
dboulet commentedReally? Blank alt and title attributes are perfectly valid in HTML, and don't cause any problems with any browser, as far as I know. What problems are you talking about?
As I understand it, one reason that the alt attribute is required for img elements, is that screen readers will read out the file name if the attribute is omitted—a side effect which is seen as annoying and completely useless. Why, then, would we want to purposefully use the file name as the alt attribute value?
And as far as the title attribute is concerned, not only is it valid for it to be left blank, but the entire attribute is optional, and may be omitted completely.
Comment #3
grandcat commentedXHTML 1.1 requires alt attribute.
Comment #4
dman commentedAn alt attribute is required, but can be blank.
W3C reluctantly recommends
<img alt="" />for non-semantic images. Browsers have no problem with this.Whether it's appropriate for a content image to use the filename as an alt is a matter of taste. I name my files usefully in the first place, so using the filename if no other information is available is still better than nothing, and potentially informative. If you haven't named your files, then DSC_123543 is probably worse than nothing.
Comment #5
grandcat commentedOK, I will think about it.
Comment #6
dboulet commentedThanks for the clarification dman. In my experience, most clients aren't as diligent as you are, and simply leave all file names as something similar to DSC_123543.jpg. That's why I suggested that it's much better to simply leave the alt and title defaults to blank.
Maybe it would be better to give users a choice? We could have checkboxes on a settings page, or in the upload dialog, like this:
[ ] Use file name for alt attribute value
[ ] Use file name for title attribute value