[thelist] accessible way to indicate that a form field is required

Max Schwanekamp lists at neptunewebworks.com
Fri Nov 17 11:00:13 CST 2006


Julian Rickards wrote:
> What are you going to do with class="required"? Color the text red? Add a
> yellow star background image? Use the CSS definition -> content: "This field
> is required";? Use JavaScript to make the text flash? All of these are good
> until someone comes along with a browser that doesn't support either CSS or
> JS (or has them disabled).
> 

Very interesting discussion.  Another thought I've had (but not 
implemented) is using the title attribute on the input element. 
According to one article[0], and corroborated by another[1], this works 
for the more common screen readers, and would have no negative effect 
elsewhere.  However I'm leaning toward putting in a span with text 
"required" and then putting it off-left (position: absolute; left: 
-9999em) with CSS, and styling the label with a bold font for visual 
users.  Though this will probably require slightly more maintenance.

[0] http://www.sf.id.au/WE05/forms.html
[1] http://juicystudio.com/article/invisible-form-prompts.php

-- 
Max Schwanekamp
NeptuneWebworks.com
541-517-9064



More information about the thelist mailing list