Dogoku Dogoku - 4 months ago 16
HTML Question

Is it semantically correct to use <h1> in a dialog?

I've gone through the code for The Incredible Accesible Dialog v3 and i have noticed that they are using an

<h1>
tag

<div id="modal" aria-hidden="false" aria-labelledby="modalTitle" aria-describedby="modalDescription" role="dialog">
<div id="modalDescription" class="screen-reader-offscreen">...</div>
<h1 id="modalTitle">...</h1>
<p>...</p>
<form name="form1" onsubmit="return false;">...</form>
</div>


So that got me thinking, is that actually semantically correct? I mean everyone keeps saying there should only be 1
<h1>
in a document.

Note that in previous versions of the dialog, they gave the dialog a
role="document"
which makes using
<h1>
ok imho

Answer

Semantically, you can start any new section of the document (section, article, nav, aside, header, footer) with an h1.

But a dialog is not a new section, although you can perfectly include it in a different section.