Headers should represent the page's structure and be nested accordingly. w3.org states the following:
Exception for fixed page sections
In fixed sections of the page, for example in sidebars, the heading ranks should not change depending on the ranks in the content area. In those cases, consistency across pages is more important.
Is this also true for modal dialogs? They usually aren't part of the actual page structure after all. Which header should we use for modal dialogs?
Bootstrap seems to always use h5s.
As an example we use a bootstrap modal in our footer which displays additional information about our application's version:
<div id="v-modal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Version</h5>
</div>
<div class="modal-body">
<p>Copyright © 2020 Foobar</p>
<p>Version 1.3.7124.19131</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" aria-label="Close">Close</button>
</div>
</div>
</div>
In an a11y test we recently received this was marked as a potential issue.