Skip to main content
The 2024 Developer Survey results are live! See the results
edited tags
Link
Joshua Taylor
  • 85.4k
  • 9
  • 160
  • 358
Source Link
Dogoku
  • 4.6k
  • 3
  • 25
  • 35

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