Design · Culture · Spirituality

Form attribute aria-required

Recently, I noticed that the default WordPress theme was updated to include the following code on the name and email fields in its comment form:

<?php if ($req) echo "aria-required='true'"; ?>

There is very little mention of this code as part of WordPress (because it is just the default theme, and most people do not use it), though there are a few questions of people who are concerned with why it doesn’t validate. Sometimes, people are encouraged to simply remove it. From one forum post, though:

From what I have read, aria-required is a handicap-man accessibility feature that allows folks with disabilities to know that certain fields are required by way of a screen readers voice alert saying, “hey moron, this is a required field”. Lots of browsers, well I should say some, do support it and some don’t…

So, for now the html W3 consortium is not going to accept aria-required until MS decides to play ball

Moron talk toward users aside, this is fantastic information for anyone who might run into the fact that their WordPress code no longer validates if they use a theme that adds this.

Occasionally, when I write I run posts through the validator to ensure that I haven’t forgotten or added something, and it was in one of these validations that I noticed the attribute. I’m keeping it in this new theme, even though it doesn’t validate, as accessibility is a desperately important and neglected part of high quality code.

Let this be a lesson, or a reminder, that valid code is not enough, nor is it always best: it can easily be inaccessible and non-semantic, and still be valid.

2 Comments

  1. Jonathan, it’s mean — in my term, that attribute is not yet accessible. I do agree to exclude IE6 and other old browsers in this case. 🙂
    Until more supported, why don’t we put a simple plain text to say the ‘required’ fields?

  2. @dani: I’m really not concerned with older browsers in this case, as they ignore the attribute. The benefit is experienced by users of screen readers, especially, though it is supported by all of the newest releases of major browsers. Even the W3C is encouraging web authors to use it (there is a great article here from Bruce Lawson).

    For what it’s worth, there is a good introduction to it from Opera. Thanks for your comment; I think it is wonderful to bring this issue into further conversation.

About the Designer

Jonathan Stegall is a web designer and emergent / emerging follower of Jesus currently living in Atlanta, seeking to abide in the creative tension between theology, spirituality, design, and justice.

Elsewhere