[whatwg] The <dialog> element and related topics

Ian Hickson ian at hixie.ch
Mon May 5 21:28:50 PDT 2008


On Sun, 17 Apr 2005, Anne van Kesteren wrote:
>
> fantasai wrote:
> > I like the definition you give here, except for one thing:
> > Despite the example given in HTML4, I think that speakers and words
> > is stretching the name-value idea a bit too far. For scripted dialog,
> > I think Tantek's suggestion is much better:
> >   http://tantek.com/presentations/2005/03/elementsofxhtml/#slide20
> 
> It also requires a lot of additional markup. Can't we just say that when you
> want to give additional semantics, like you need to use DFN for real
> definitions, you need to use <dt><cite>{Person}</cite> and either
> <dd><q>{Quote}</q> or <dd><blockquote>...{Quote}...</blockquote>.
> 
> 
> > So my suggestion is to remove that particular example from the spec.
> 
> I think it should be kept. But that there should be a similar note like the
> one about DFN.

This is all moot now with <dialog>, as far as I can tell.


On Thu, 9 Jun 2005, J. Graham wrote:
>
> I hate to disrupt all the fun but if the concern is the ability to markup
> Uylsses in a semantic way, we have much bigger problems than <hr />. The total
> lack of an element for expressing direct speech, say [1]. Worse, Uylsses
> considers speech to be block level but speech blocks (identified by a leading
> em-dash) can be contaminated with identifcation of the speaker:
> "Has the wrong sow by the lug. He is my father. I am his son.
> -That mole is the last to go, Stephen said, laughing."

I don't think the above needs any special HTML markup.


> There's also no way to represent a script-like structure in HTML. An aural
> rendering of a script would probably leave out the names of the characters but
> use distinct vocal styles so the reader could follow who was speaking. There
> would also need to be some sort of markup to distinguish a stage direction so
> fragments like:
> 
> "BLOOM: (With sinews semiflexed) Magnificence
> BELLO: Down! (He taps her on the shoulder with his fan) Incline feet forward!
> Slide left foot one pace back. You will fall. You are falling. On the hands
> down!"
>
> Can be rendered correctly. So to do it properly, we need markup to specify the
> age, sex and ethnicity of the speaker. And their emotional state? Obviously we
> need an attribute for each speech block to link it to the
> speaker-declaration...

<dialog> with classes for more fine grained styling should be adequate.


> No, I'm not being serious. But the point is that HTML does such an
> astonishingly poor job of marking up fiction (and a wide variety of other
> document types too, no doubt) that arguing over whether seperators should be
> empty elements or not is just semantic navel-gazing.

Indeed.


> [1] Note "Content inside a q element must be quoted from another source",
> which direct speech is not. Whilst I'm here, I'll point out that "The q
> element represents a part of a paragraph quoted from another source." isn't
> very clear - I assume that "part of a paragraph" means a paragraph in the html
> document, not in the source - but it could be interpreted the other way around
> so that quoting poetry, for example, is forbidden

Fixed.


On Tue, 31 Oct 2006, Michel Fortin wrote:
>
> I think if HTML5 deprecate the use of <dl> for dialog, that it ought to
> provide a an alternative syntax for them. I know it has already been
> discussed, but I'd suggest this:
> 
>     <dialog>
>     <p><cite>Me:</cite> <q>Can I say something?</q>
>     <p><cite>Him:</cite> <q>No!</q>
>     </dialog>
> 
> In this design, <dialog> is optional, only needed when the dialog needs to be
> separated from the main text, <q> is optional when inside <dialog>, and <cite>
> can be omitted if the interlocutor name is not specified. This leaves much
> flexibility when writing dialogs, and thus allows the markup to be used for
> dialogs at places <dl> could not.

The spec now has <dialog> with <dt> and <dd>.


> For instance, this is a dialog, but since its mixed with the main text you
> can't surround it by <dialog>. Also, using <cite> in here isn't very
> practical, as the text refers to the speakers as "he" or "she" most of the
> time.
> 
>     <p>He was downstair when he heard a strange noise from outside. When he
>     went to see, he saw Julietta in the park screaming at him: <q>Where were
>     you?</q></p>
> 
>     <p><q>I was busy fixing the pipes. What happened here?</q> he asked.</p>
> 
>     <p><q>There was a cat on the tree</q>, she said. <q>It jumped and landed
>     in here.</q> She was pointing at a crate full of pieces of metal. <q>I
>     jumped!</q></p>

Why you need <q> markup here I don't know. Just use quote marks...


> It's interesting to note however that the same text could be surrounded by
> dialog tags when formatting the same dialog in French. In the following
> example, <q> must be styled with no marks and add em dashes must be added at
> the start of each paragraph in the dialog (this could be done by CSS, although
> here I've done it in the source for clarity):
> 
>     <p>Il était au sous-sol quand il entendit un bruit étrange venant de
>     dehors.
>     Quand il est alla voir ce qui se passait, il vit Julietta dans le park qui
>     lui cria:</p>
> 
>     <dialog>
>     <p>— <q>Où étais-tu ?</q></p>
>     <p>— <q>J'était occupé à réparer les tuyaux. Qu'est-ce qui c'est passé
>     ici ?</q> a-t-il demandé.</p>
>     <p>— <q>Il y avait un chat dans l'arbre</q>, dit-elle. <q>Il a sauté
>     pour atterrir juste là.</q>
>     </dialog>
> 
>     <p>Elle pointant une caisse pleine de morceaux de métal.</p>
> 
>     <dialog>
>     <p>— <q>Et j'ai fait le saut !</q></p>
>     </dialog>
> 
> Note that without <q> in the previous example, there is no easy way to
> distinguish inserted text like "dit-elle" ("she said"), these are typically
> disambiguated from context in French. But I'd consider the <q> element
> optional anyway, even if omitting it leaves this ambiguity. The reason being
> that there is no way to disambiguate inserted text inside inline quotations
> either. What I did in the previous dialog requires the removal of the quote
> characters in the styling of <q>, but to be consistent you'd need to do that
> with inline quotations too, which goes against both the recommended usage and
> the default stylesheet for <q>:
> 
>     « <q>Pourquoi se déplacer ?</q> dit-elle. <q>On a pas besoin de vous</q> »
> 
> Personally, I think this is how <q> should have worked from the start, but it
> may be too late to change that. Anyway, let's return to the subject of
> dialogs.

I don't see the need for any markup for these examples.


> The second type of dialog I considered is more like in a theatrical piece,
> where dialogs are completely free of any other prose. It was previously
> suggested in HTML4 to use <dl> for this:
> 
>     <p>Mary and Mark begin walking in the park.</p>
> 
>     <dl>
>     <dt>Mary</dt>
>     <dd>So where do you want to go tomorrow? I can tell you already
>         have something in mind.</dd>
>     <dt>Mark</dt>
>     <dd>What makes you think that?</dd>
>     </dl>
> 
> I think it'd be better expressed this way:
> 
>     <p>Mary and Mark begin walking in the park.</p>
> 
>     <dialog>
>     <p><cite>Mary:</cite> So where do you want to go tomorrow? I can tell
>        you already have something in mind.</p>
>     <p><cite>Mark:</cite> What makes you think that?</p>
>     </dialog>
> 
> Here, <q> tags would be optional because the dialog element already implies
> that everything in the paragraphs is part of the dialog. And since <q> adds
> quotes, which are not desired in this case, it'd probably be a bad idea to add
> it anyway.

The <dialog> element in the spec now takes the best of both of the above 
proposals.


On Tue, 31 Oct 2006, Henri Sivonen wrote:
> 
> What benefits do consumers of HTML get from knowing that something is a 
> dialog?
> 
> What tangible benefits can authors see from marking up dialogs as 
> dialogs? That is, what is the incentive to bother?
> 
> If most authors are not incentivized to mark up their dialogs as such, 
> is there still enough value for consumers of markup if only relatively 
> few dialogs are marked up as dialogs?

The main reason for <dialog> is to resolve the evergreen debate about what 
markup to use for dialogs, so actually the questions above are mostly 
moot. :-)


On Wed, 1 Nov 2006, Michel Fortin wrote:
> 
> People have asked how to markup dialogs for a long time, but many are 
> reluctant to use <dl> because it is named "definition list" and a dialog 
> has absolutely nothing to do with a definition list (basically a dialog 
> does not define anything, and it isn't a list more than a couple of 
> adjacent paragraphs form a list).
> 
> Well, if it comes that <dl> can be used for dialogs, fine. But I believe 
> that introducing a <dialog> element will makes things clearer, as HTML4 
> has explicitly proposed the use of <dl> for dialogs and many people 
> still find that dumb.
> 
> Is there a value in knowing something is a dialog? Not always, that's 
> certain. But in certain contexts it is important for styling as there's 
> no punctuation to tell what is a dialog and what is not. That's when 
> <dl> was used.

Indeed.


On Wed, 1 Nov 2006, Øistein E. Andersen wrote:
> 
> In some contexts, direct speech is italicised (unlike other words that 
> happen to be enclosed within the same pair of quotes). Let me quote a 
> passage from Le Monde:
> 
> > Le policier évoque son étudiant avec émotion. "<i>J'ai vite vu sa 
> > volonté peu commune d'apprendre et de réussir,</i> dit-il. <i>Il 
> > avait la souplesse du roseau, la volonté de répondre aux attentes du 
> > jury, d'adopter les codes culturels, clés de son intégration.</i>"
> 
> Here, <q> arguably would make sense (instead of <i>, which is what Le 
> Monde currently uses on its website). I cannot remember to have seen 
> this style in a novel, though.

<i> would be fine for this. It matches the definition in the spec: "a span 
of text in an alternate voice".


On Wed, 20 Dec 2006, Simon Pieters wrote:
> 
> Many transcripts on the Web include timestamps, in particular chat logs. 
> If chat Web applications are to use <dialog>, then those apply aswell. 
> I'm sure there are other examples too.
> 
> I think <dialog>s should support a way to mark up timestamps. I'd 
> suggest <time> in the <dt>:
> 
>   <dialog>
>    <dt><time>00:01</time> zcorpan
>    <dd>speaking of &lt;dialog>... can &lt;dt> include other stuff, like time
> stamps?
>    <dt><time>00:01</time> Hixie
>    <dd>zcorpan: not currently
>   </dialog>

Added.


On Thu, 21 Dec 2006, Michel Fortin wrote:
>
> I read this text recently:
> 
> <http://daringfireball.net/2006/12/apple_universal_conjectural_transcript>
> 
> and wondered how it could be marked up using <dialog>. Basically, it's a 
> fictional dialogue between two persons where once in a while the 
> dialogue is interrupted by actions in separate paragraphs. It looks much 
> like a scene in a screenplay.
> 
> The current spec only allows <dt> and <dd> inside <dialog>, so the 
> markup for something like this would require closing <dialog> each time 
> an action paragraph is added and reopening it afterward. Wouldn't it 
> make more sense to allow regular paragraphs in <dialog> for situational 
> information and action descriptions?

What's wrong with closing the <dialog>?


On Thu, 21 Dec 2006, Benjamin Hawkes-Lewis wrote:
> 
> Maybe. Or perhaps the narrator/stage descriptions should be part treated 
> as another interlocutor. Or perhaps we need an element (<action />, 
> <stage-direction />, <narration /> ?) for such descriptions; which 
> should be capable of being both block and inline. You can have short 
> stage descriptions actually intermixed with dialogue.

Sadly new elements wouldn't work well with the parser.


On Fri, 30 Mar 2007, Michel Fortin wrote:
>
> Here are some various potential use cases for <dialog> I've collected 
> and which I think are problematic with the way the <dialog> element is 
> currently defined.
> 
> Regular dialogue:
> 
> http://www.newyorker.com/humor/2007/03/26/070326sh_shouts_rich

We can do everything in that except the annnotations like "(laughing)". 
I'm not sure how to handle those.


> IRC Logs:
> 
> http://www.linode.com/irc/logs/linode-xenbeta.log-2006-03-26

We can't do /me, but other than that we're ok, no? I'm not sure how to do 
/me actions.


> Screenplay (not a dialogue in itself, but contains a couple of them):
> 
> http://www.lynchnet.com/mdrive/mdscript.html

Here again the only bits we can't do are the annotatons -- (con't), 
(disgusted with himself), etc.


> Adding specific elements for all these use cases is probably not going 
> to be a good idea since there are too many of them. But I think allowing 
> regular paragraphs in the content of <dialog> would be useful in a 
> couple of cases. This is an excerpt from the first linked page formatted 
> this way:
> 
>     <dialog>
> 
>       <dt>FRIEND FROM WORK:</dt>
>       <dd>I am the loudest! I am the loudest!</dd>
> 
>       <p>(Everybody laughs.)</p>
> 
>       <dt>MOM:</dt>
>       <dd>I had a lot of wine, and now I’m crazy!</dd>
> 
>     </dialog>
> 
> Formatted excerpt from second link (an IRC log):
> 
>     <dialog>
> 
>       <p><time>21:57</time></p>
>       <dt>caker</dt>
>       <dd>sweet</dd>
> 
>       <p><time>21:57</time></p>
>       <dt>caker</dt>
>       <dd>it worked</dd>
> 
>       <p><time>21:57</time></p>
>       <p class="action">caker closes out last bug</p>
> 
>       <p><time>22:04</time></p>
>       <dt>encode</dt>
>       <dd>yay!</dd>
> 
>     </dialog>
> 
> These to examples are non-conformant according to the current spec. I 
> won't say this is the ideal markup, but I think it's still better than 
> opening and closing a dialog element each time you need a <p> element. 
> Any better way to markup these?

Paragraphs can just be included outside the <dialog> (close out the dialog 
and reopen it). And we've handled <time> now. But I'm not sure how to 
handle the annotations and actions.


On Fri, 30 Mar 2007, Anne van Kesteren wrote:
> 
> If I remember correctly <li> was suggested for this purpose on IRC. The 
> advantage of <li> over <p> would be that people wouldn't easily think 
> you could put anything inside <dialog> (as you put <p> almost anywhere).

Anything but <dt> and <dd> is going to cause us headaches in the parser.


On Wed, 4 Apr 2007, David Walbert wrote:
>
> In this case it seems to me that the <p><time> combination is itself a 
> header for the dt/dd pair that follows, but the <p> markup doesn't 
> convey that. Some sort of specialized markup might be preferable here. I 
> don't know how much demand for it there would be, though. (Less, I 
> think, than for the ability to mark up an action in the middle of 
> dialogue.) If the time doesn't have to be a separate block-level 
> element, it could be marked up simply as
> 
> <dialog>
> 	<dt>caker (<time>21:57</time>)</dt>
> 	<dd>sweet</dd>
> ...

With the parentheses inside the <time>, but yes, that's what the spec has 
now.


On Wed, 4 Apr 2007, Michel Fortin wrote:
> 
> Indeed it could... in this case. Sometime however the time is indicated 
> every 5, or 10 minutes to not overload the dialogue with time 
> references, in which case associating the time reference with the 
> speaker may not be the best thing to do.
> 
> For instance, take the much more complicated case of the hansard of 
> debates in the Canadian Parliament: here is a link to the oral questions 
> of the latest session:
> 
> <http://www2.parl.gc.ca/HousePublications/Publication.aspx?Mode=1&Parl=39&Ses=1&DocId=2823652&Language=E#OOB-1998516>
> 
> Of semantic importance here, you'll find time markers every 5 minutes -- 
> (1115) for 11:15 -- and also language change markers -- [Translation] or 
> [English] -- indicating if the text following it has been translated or 
> not. Note that both of these markers can actually appear between two 
> paragraphs with no change of interlocutor, or they can appear just above 
> the name of a new interlocutor. I'm not quite sure how the markup should 
> accomodate this, but I think the rules ought to be flexible enough.

That page doesn't look like it would use <dialog> to me. More just use of 
<p> and <q> and/or <blockquote>.


On Tue, 10 Apr 2007, Kevin Marks wrote:
> 
> I think the <dialog> example is a retrograde step. The
> <ol><li><cite><q|blockquote> pattern seems much better than redefining
> <dt> and <dd>, which will confuse XOXO parsers that try to be
> Postelian. Did I miss some reasoning here?

A conversation isn't an ordered list, and a fictional text isn't a quote.


On Wed, 11 Apr 2007, Kevin Marks wrote:
> 
> My point is that this is breaking the expected containment of <dt><dd> 
> in a <dl>- if you want a new structure purely for dialog, define 
> <speaker> and keep <q>.  I really fail to see why redefining a 
> definition list as speech is less 'proper' than expanding the context of 
> <q> slightly.

Were using a new element, not <dl>.


On Tue, 17 Apr 2007, Michel Fortin wrote:
> 
> What I find silly with the current <dialog> proposal is that it just 
> can't handle a lot of trivial cases which would otherwise be perfect use 
> cases. It can't because you can't include non-spoken events to be 
> inserted in the sequence.

I don't understand why closing the dialog and reopening it is so bad.


> As an example:
> 
>     <p><speaker>Me</speaker>: <speech>... and that was all I had to
> say.</speech></p>
> 
>     <p>Someone else enter the room.</p>
> 
>     <p><speaker>Someone else</speaker>: (thinking aloud) <speech>Wow!
> </speech></p>
> 
> Otherwise, the spec tries to draw the line between what is and what is 
> not a valid dialog... that should be the author's call in my opinion.

I don't see why we would need those elements. You can already do the above 
without them.

Using <dt>/<dd> has the advantage of working today.


On Wed, 10 Oct 2007, Henri Sivonen wrote:
> 
> The draft says: "Zero or more pairs of dt and dd elements."
> 
> I suggest making it clearer by saying: "Zero or more pairs of one dt 
> element followed by on dd element."

Done.


On Thu, 28 Feb 2008, Dave Hodder wrote:
> html at nczonline.net wrote (with snippage):
> >     *   I understand the concept of the <dialog/> element but it's named
> > completely wrong. The point is to markup a conversation between two or more
> > parties. The problem is that the word "dialog", when in used in user
> > interfaces, refers to small windows that can be interacted with. When I
> > first read about this element, I assumed it was a way to indicate that part
> > of the page is a dialog window outside of the normal flow of the document
> > (which I thought was cool). After reading the rest, I was disappointed to
> > find out that wasn't the intent. I'd rename this element as <conversation/>
> > or <discussion/> to avoid such misunderstandings.
> 
> I was confused by the name of the "dialog" element in exactly the same way you
> were, originally thinking it was to do with pop-up dialogue boxes.  The HTML 4
> spec states:
> 
>     Another application of DL, for example, is for marking up
>     dialogues, with each DT naming a speaker, and each DD containing
>     his or her words.
> 
> ... which I presume influenced the addition of this element.  If there is a
> lot of dialogue marked up on the Web it deserves its own element, if not I
> guess DL could be considered to stand for "dialogue list" in addition to
> "definition list".

<dl> really doesn't work well for dialogue -- it's not name-value pairs if 
the same speaker speaks several times.

I don't think <conversation> or <transcript> or <discussion> are better 
than <dialog>. I agree that "dialog" is a suboptimal name, though.


On Thu, 28 Feb 2008 html at nczonline.net wrote:
>
> Perhaps the "role" attribute would be appropriate to use on <dl/>, such 
> as <dl role="conversation"/>?

I don't think that's any better.


On Fri, 29 Feb 2008, Nicholas C. Zakas wrote:
>
> As discussed earlier this week, the <dialog/> element is confusing in 
> that the term "dialog" in software engineering typically means "dialog 
> window". I first thought the element was a way to indicate that a part 
> of the page was used as a dialog rather than part of the normal content 
> flow. I understand the need to disambiguate the use of the <dl/> 
> element, keeping it as a definition list, so how about <cl/> for a 
> conversation list?

I think <cl> is even less clear than <dialog>.

-- 
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