This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17158 - Remove the <legend> tag and add it as an attribute to <fieldset> Example <fieldset legend="Personal information">
Summary: Remove the <legend> tag and add it as an attribute to <fieldset> Example <fie...
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords: a11y
Depends on:
Blocks:
 
Reported: 2012-05-23 12:41 UTC by contributor
Modified: 2012-06-20 15:45 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2012-05-23 12:41:17 UTC
Specification: http://www.w3.org/TR/html5/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
Remove the <legend> tag and add it as an attribute to <fieldset>

Example <fieldset legend="Personal information">

Posted from: 212.247.162.243
User agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:15.0) Gecko/15.0 Firefox/15.0a1
Comment 1 Simon Pieters 2012-05-23 13:42:57 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Did Not Understand Request
Change Description: no spec change
Rationale: Why? What's the problem you're trying to solve?
Comment 2 Fred 2012-05-28 08:24:15 UTC
The <legend> is an unnecessary tag, it just clutters the tag namespace and makes it harder learn HTML.

It is only used in <fieldset> so instead of having a separate tag, it should be an attribute of fieldset.

Having legend as an attribute of fieldset instead of as a separate take makes more sense, makes learning HTML easier, removes unnecessary tags that clutter, provides a cleaner DOM and allows autocompletion.

It also makes it more semantically correct because it is paired explicitly with the fieldset tag.

Current markup:
<fieldset>
  <legend>Information</legend>
  Lorem ipsum...
</fieldset>

Proposed markup:
<fieldset legend="Information">
  Lorem ipsum...
</fieldset>
Comment 3 Simon Pieters 2012-05-28 08:31:44 UTC
(In reply to comment #2)
> The <legend> is an unnecessary tag, it just clutters the tag namespace and
> makes it harder learn HTML.

It's necessary to give a title to fieldsets.

> It is only used in <fieldset> so instead of having a separate tag, it should be
> an attribute of fieldset.

Attributes can't contain markup. Also, this change wouldn't be backwards compatible.

> Having legend as an attribute of fieldset instead of as a separate take makes
> more sense, makes learning HTML easier, removes unnecessary tags that clutter,
> provides a cleaner DOM and allows autocompletion.

I don't see how it does any of those things.

> It also makes it more semantically correct because it is paired explicitly with
> the fieldset tag.

The semantics would be the same.

EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: Not backwards compatible and would remove the ability to use markup in the legend.
Comment 4 Fred 2012-05-28 09:29:19 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > The <legend> is an unnecessary tag, it just clutters the tag namespace and
> > makes it harder learn HTML.
> 
> It's necessary to give a title to fieldsets.

Indeed it is, but it should be set through an attribute, not another (nested) element.

> 
> > It is only used in <fieldset> so instead of having a separate tag, it should be
> > an attribute of fieldset.
> 
> Attributes can't contain markup. Also, this change wouldn't be backwards
> compatible.

Oh, so the reason for the legend tag is so there is a way to add markup to it?
Sorry, this was not something I failed to consider.

Admittedly it does break backwards compatibility, I am aware of that, but on the other hand it feels cleaner.

> 
> > Having legend as an attribute of fieldset instead of as a separate take makes
> > more sense, makes learning HTML easier, removes unnecessary tags that clutter,
> > provides a cleaner DOM and allows autocompletion.
> 
> I don't see how it does any of those things.

Easier to learn because there would be one less tag to learn.

Cleaner DOM because one less element in the DOM.

An IDE could provide autocompletion/autosuggestion for the legend attribute when opening the fieldset tag.
Legend would be local to fieldset and not global as it is now.

> 
> > It also makes it more semantically correct because it is paired explicitly with
> > the fieldset tag.
> 
> The semantics would be the same.

No, because now there is no coupling.
fieldset and legend are not semantically coupled together, even though they are used together, so it lacks semantics.
But if legend were an attribute of fieldset, then then legend would be coupled to fieldset, and hence there would be a semantic coupling between the two.
Comment 5 Simon Pieters 2012-05-28 10:41:05 UTC
(In reply to comment #4)
> Admittedly it does break backwards compatibility, I am aware of that, but on
> the other hand it feels cleaner.

We usually don't trade backwards compatibility for cleanness.

> Easier to learn because there would be one less tag to learn.

But one more attribute.

> Cleaner DOM because one less element in the DOM.

OK, I can buy that.

> An IDE could provide autocompletion/autosuggestion for the legend attribute
> when opening the fieldset tag.

It could do that with an element as well, as far as I can tell.

> No, because now there is no coupling.

Yes there is. A fieldset's legend is the first legend element that is a child of the fieldset element, if any.
Comment 6 Fred 2012-05-28 11:36:07 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Admittedly it does break backwards compatibility, I am aware of that, but on
> > the other hand it feels cleaner.
> 
> We usually don't trade backwards compatibility for cleanness.
> 
> > Easier to learn because there would be one less tag to learn.
> 
> But one more attribute.

Yes, but the attribute would be in the scope of the element, so it would still be easier to learn since you wouldn't unnecessarily meet legend before fieldset.

> 
> > Cleaner DOM because one less element in the DOM.
> 
> OK, I can buy that.
> 
> > An IDE could provide autocompletion/autosuggestion for the legend attribute
> > when opening the fieldset tag.
> 
> It could do that with an element as well, as far as I can tell.

Such autocompletion would be possible, but would not be as easy to implement, it would be an ugly implementation.

> 
> > No, because now there is no coupling.
> 
> Yes there is. A fieldset's legend is the first legend element that is a child
> of the fieldset element, if any.

Well the coupling is very loose.
It does not feel "right", it feels more like a hack.
That's not the way of XML/SGML, its not in its spirit.