WebAIM - Web Accessibility In Mind

E-mail List Archives

RE: can <p> be used in place of <legend>?

for

From: Tim Harshbarger
Date: Jul 20, 2006 6:00AM


In regards to JAWS, it is better to use the legend element rather than
the paragraph or any of the heading elements.

If you use a legend within a fieldset element, JAWS will always read the
contents of the legend element when the user tabs to any of the controls
within the fieldset.

If you use either the paragraph or heading elements, JAWS might read
that information or it might not.

My guess is that when the paragraph or heading elements are used, JAWS
has to rely on an algorithm to determine if there is a legend and what
the legend might be. When the legend element is used, JAWS can rely on
the mark-up.

I expect that is why you will sometimes receive reliable results using a
paragraph or heading elements.

If you choose to encode the legend content with a paragraph or heading
element, there is something you need to be aware of. While testing in
your environment might indicate that a screen reader will always read
the legend information correctly, that will only be the case for the
users if their display mimics yours exactly. If their display is
different, what is read will depend on how the browser presents the
information.

Unfortunately, I am not as familiar with the other screen readers, so I
cannot speak to how they deal with these elements.

Tim