Log in

Accessify Forum - Accessibility Discussion

Latest Tweets

Recent Tweet

User desperately needs help. Is he being #discriminated under the #ADA? Read his story at: http://www.accessifyfo... - Gary

Today, RT: @AccessifyForum

Recent Tweet

User desperately needs help. Is he being #discriminated under the #ADA? Read his story at: http://www.accessifyfo... - Gary

Today

Err. Sorry. Haven't quite got the hang of multiple accounts on @seesmic just yet! :-(

Yesterday

@mollydotcom going on the #HTML5 demystification! :-)

Yesterday

Web #accessibility training in Edinburgh this fall: about WCAG2, understand WAI-ARIA, more http://www.rnib.org.uk... - Gary

2 days ago, RT: @webaxe

Read more...

Currently Online

No registered users are online.

Use of Headings in Fieldsets

  • Reply to topic
  • Post new topic

Home / Site Building & Testing / Use of Headings in Fieldsets

Reply with quote Hi all

Consider this:

Code:

<fieldset>
<legend>Method of Contact</legend>
<p>How shall we contact you?</p>
<label for="how_contact_phone">

... selection of labels and radio buttons

</fieldset>


I'm having a conversation with a developer who thinks it would be better to make the <p> that precedes the radios into an <h2>.
Is it more semantically correct to use headings rather than paragraphs within fieldsets? Is it more accessible with regard to the example above?

Thanks
Reply with quote Nested fieldset and legend is the right structure for this content. However, the more usable solution is to simply the form whenever possible.

The text "Method of Contact" is ambiguous. Contact who? So you have some text to explain it's really asking: "How shall we contact you?" This explanation is so short yet so complete that it could entirely replace the unhelpful legend text:
Code:
<fieldset>
<legend>How shall we contact you?</legend>
<label for="how_contact_phone">

... selection of labels and radio buttons

</fieldset>
This removes the issue you describe whilst simplifying the form for everyone.
_________________
My CV type thing and my Life of Ben (Blog). Nigel Peck's Accessify Forum Requirements.
Reply with quote Forgive me for posting a weak example of code. I agree with your comments entirely, but the question remains - if you need to introduce a set of radio buttons within a fieldset is it best to use a heading? What about a simple yes/no selection? Does this require a heading to markup the question? Or are you saying that a series of radio buttons should warrant a fieldset of their own?
Reply with quote Fieldsets can be nested, so you could nest a second fieldset around the radio buttons, with a legend of its own.

I seem to remember that screenreaders ignore headings, paragraphs and other non-forms elements when in forms mode, so text in headings might not be read out once a screenreader user starts to fill out the form.
_________________
Jim O'Donnell
work: Royal Observatory Greenwich
play: eatyourgreens
Reply with quote
eatyourgreens wrote:

I seem to remember that screenreaders ignore headings, paragraphs and other non-forms elements when in forms mode, so text in headings might not be read out once a screenreader user starts to fill out the form.


Yeah, JAWS certainly does in forms mode.

To complicate matters further, there're also bugs with some versions of Jaws and nested fieldset legends. I think it was version 8 that was fairly random in which legend it announced. I'll have to check, I had a test case somewhere.

-Matt
_________________
Matt Machell
Web Design and Development Blog
Member of the Multipack
Reply with quote
stephenlang wrote:
[...] if you need to introduce a set of radio buttons within a fieldset is it best to use a heading?
If the <fieldset> contains other controls in addition to the group of radio buttons, then do what EYG says and give them a <fieldset> within the <fieldset>.

It ends up something like this (many attributes omitted):
Code:
<fieldset>
 <legend>Your Details</legend>

 <label>Name</label> <input>
 <label>Address</label> <textarea></textarea>
 <label>Phone Number</label> <input>
 <label>E-mail</label> <input>

 <fieldset>
  <legend>How you you like us to contact you?<legend>

  <input type="radio"> <label>Post</label>
  <input type="radio"> <label>Telephone</label>
  <input type="radio"> <label>E-mail</label>
 </fieldset>

 <input type="checkbox"> <label>Receive our Newsletter?</label>
</fieldset>

<input type="submit">
In this particular case, I'd probably use a group of checkboxes than a group of radio buttons. Or I might make all the contact details optional and use whatever method(s) the user filled in. This would remove the "How you you like us to contact you?" section entirely.

stephenlang wrote:
What about a simple yes/no selection? Does this require a heading to markup the question?
If you have a yes/no option, just use <input type="checkbox"> with an appropriate <label>.

Stephen, can you give a more realistic example of what this might be used for? I find that if I'm struggling to figure out the markup for something, it's often because that something is too weird. Redesigning it to be normal is the best solution in these cases, but that's not always possible.

stephenlang wrote:
Or are you saying that a series of radio buttons should warrant a fieldset of their own?
Precisely. Smile

(EDIT) Re-arranged to make a bit more sense.
_________________
My CV type thing and my Life of Ben (Blog). Nigel Peck's Accessify Forum Requirements.


Last edited by Ben Millard on 04 Sep 2008 04:53 am; edited 1 time in total
Reply with quote Cerbera, thanks for your input on this. I don't have a proper example as I'm currently working on the CSS for a generic form template. So most of the things coming up are "what ifs?" For example, what to do with radio buttons, can we use nested fieldset etc.

The idea is to provide the CSS with HTML examples for contractors to build applications (which, when you don't get what you asked for, can be done badly).

  • Reply to topic
  • Post new topic

Display posts from previous:   

All times are GMT

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum