twitter/bootstrap — Issue #1214: [2.0-wip] Usage of <fieldset> 
Author: olvlvl
Created: 2012-01-25 19:37:41+00:00
State: open

According to the w3c specification "the FIELDSET element allows authors to group thematically related controls and labels. Grouping controls makes it easier for users to understand their purpose while simultaneously facilitating tabbing navigation for visual user agents and speech navigation for speech-oriented user agents. The proper use of this element makes documents more accessible."

In 2.0 the `fieldset` element is longer used to group controls but to wrap each one of them to create label/control units. In my opinion there is three problems with this usage:

1. There is no grouping anymore. Legends might still be used as dividers but because they are optional, where there is no legend there is no group. I don't know how this works for speech-oriented user agents.

2. You can't manage groups easily. If you want to show/hide a group you have to manually hide each of its elements or use a `div` to achieve what the `fieldset` element was meant for. More over if you show/hide a group you also have to take care of the `legend` because it's now _outside_ the group. For the same reason, moving the group around proves to be difficult.

3. The usage of the `legend` element does not conform to standards: "The `legend` element represents a caption for the rest of the contents of the legend element's parent fieldset element."

For all these reasons, I would like to propose the following:

Optional legend

Optional label of the input

Optional label of the input

With this proposal, the purpose of the `fieldset` element is preserved, the `legend` element is where it should be (according to specifications) and each control remains wrapped in a label/control unit.

What do you think ? If you are not dead set on the usage of the fieldset in 2.0 I can provide a patch, I've already implemented it for my toolkit: