[whatwg] HTML as a text format: Should <title> be optional?

Ian Hickson ian at hixie.ch
Mon Oct 5 19:40:39 PDT 2009

On Wed, 23 Sep 2009, Brian Campbell wrote:
> On Jun 4, 2009, at 6:42 PM, Ian Hickson wrote:
> > On Fri, 17 Apr 2009, Øistein E. Andersen wrote:
> > > 
> > > A <title> is usually a good idea, but is it really necessary to 
> > > require this for conformance?  After all, a <title> is not something 
> > > which an author is likely to forget, and leaving it out has no 
> > > unexpected consequences.
> > 
> > Leaving it out has a pretty important consequence, it breaks user 
> > interfaces that need to refer to the document, e.g. "bookmarks" 
> > features in browsers.
> HTML documents sometimes occur in places in which they are not 
> independently bookmarkable, such as in an HTML email, or embedded in an 
> Atom or RSS feed.
> They also sometimes occur in places in which it's generally not expected 
> that someone will bookmark them, nor particularly easy to do so, such as 
> within an iframe which is being used for a gadget or some sort of 
> sandboxed content that isn't really independent of the containing page.

True, but it's still easy to include the title in those cases, and in some 
of those cases doing so is actually useful for improving accessibility 
(e.g. ATs can use <title>s of subframes to help a user navigate amongst a 

> > On Sat, 18 Apr 2009, Randy Drielinger wrote:
> > > 
> > > If you're converting from a textfile, title could refer to the filename.
> > > 
> > > If it's an automated process, it can be added by default.
> > > 
> > > If it's manual, they'll have to remember the short html5 doctype and the
> > > title element.
> > 
> > It does indeed seem easy to include it.
> Yes, but sometimes you don't have a reasonable value for the title. Say you
> are converting some word processing document format to HTML (or spreadsheet,
> or slides, or anything of the sort); what would you use if there isn't any
> sort of heading to take the title from?

The filename, probably, or the first few words. Or "Untitled document", 
for that matter.

> There are several options (you could use the filename, or look for 
> anything heading like, or use the first couple of words), but if a 
> <title> element is missing, then the user agent could do the same.

New UAs could, yes. Old UAs don't.

> > On Sat, 18 Apr 2009, Øistein E. Andersen wrote:
> > > 
> > > It could, but chances are that the original filename would typically 
> > > be less useful than the URL, which is what most browsers use when 
> > > the <title> element is omitted, so this rather sounds like an 
> > > argument against forcing authors to include a <title>.
> > 
> > I don't see why this would be the case. In practice, however, if one 
> > is at a loss as to what to use for the <title>, but one has an <h1>, 
> > then I would recommend using the <h1>'s contents.
> This has the problem of duplicating content, which may get out of sync. 

Is that a big problem for titles in practice? I haven't seen it being much 
of an issue.

> And why can't the user agent just extract the title from the heading if 
> it needs it rather than the generator?

It probably could, but that's not a reason to make it optional, IMHO.

> > > Yes, my concern is that a validator should be useful as an authoring 
> > > tool and not overwhelm the author with spurious errors.  As I see 
> > > it, leaving out <title> is very much like leaving out a paragraph of 
> > > text and not something that should matter for validation.
> > 
> > As it affects user interfaces, and since the cost of including a 
> > <title> is so low, I think it makes sense to continue to make it 
> > required.
> As it's something that affects the user interface in a fairly visible 
> way, it's not likely that many authors will neglect to use it if it's 
> useful to do so. However, in some cases it is not possible to include a 
> title, or there isn't any really useful title to include, so I'm not 
> sure why it should be required in those cases.

The cases right now where a title would be hard to include are pretty 
rare. Maybe if it becomes more common, we should revisit this.

> This seems somewhat analogous to the <img alt> case; there are some 
> times when you don't have any useful text to put in there, and putting 
> in auto-generated placeholder text just to conform seems less than 
> useful.

In HTML%, alt="" (or a surrogate) is still effectively required, though.

> The number of pages unhelpfully titled "Untitled" or "Untitled page" 
> seems to confirm this.

Most pages called that _should_ have a title, as far as I can tell. So 
they aren't relevant here.

> There are other cases in which a title just isn't all that useful, like 
> an iframe; the title will be invisible, and it's pretty uncommon for 
> people to open that iframe in a new tab and then bookmark it from there 
> (unless maybe they happen to be web geeks like us).

Such titles are still useful for navigation in ATs.

> For example, see Google Gadgets 
> <http://www.google.com/webmasters/gadgets/>, or iframe sandboxes used 
> for isolating untrusted content while still being inline in the page.

Yes, if we add doc="" support to <iframe> maybe that would make this case 
common enough that we should reconsider.

> So, my recommendation is that <title> be made optional; perhaps a 
> validator could issue a warning if you leave it off, but there are 
> perfectly valid cases of wanting to produce an HTML document that 
> doesn't have any sort of meaningful title or for which a title will 
> never be seen or used, it doesn't seem likely that people will forget it 
> in cases in which it's useful,

I think this is something we should revisit in a future version. I'm not 
convinced we're at a stage yet where there are enough non-standalone HTML 
pages that it makes sense to not require <title> for any pages. Changing 
something this fundamental can have social repurcussions in the community 
that aren't obvious (e.g. old timers saying we're ruining HTML4), and I 
feel that we've done enough of that already with HTML5 without changing 
this also, frankly.

> and right now it is sometimes being filled with useless values like 
> "Untitled" that actually get in the way of a UA computing a better value 
> (such as the URL or the top level heading).

Are we sure that making it optional would actually affect that? It seems 
like authoring tools are pretty well baked in terms of their <title> 
features, I wouldn't expect them to suddenly change this.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list