Skip to content

Commit 77da7c7

Browse files
committed
fix(template): Use <div> instead of <main> to support Vue3 apps mounting
Vue3 does not replace the element while mounting but only renders within (replace inner HTML). So it would result in two stacked `<main>` elements which is invalid and an accessibility issue. Instead we just use a `<div>` element for mounting. For Vue2 apps this does not change anything as the whole element will be replaced with a new `<main>` element. For vanilla apps this will slightly decrease the accessibility as the main landmark is now missing, but this is not a hard accessibility issue as it would be for Vue3 apps having two main elements. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 184e715 commit 77da7c7

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

core/templates/layout.guest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@
4747
</div>
4848
</header>
4949
<?php endif; ?>
50-
<main>
50+
<div>
5151
<h1 class="hidden-visually">
5252
<?php p($theme->getName()); ?>
5353
</h1>
5454
<?php print_unescaped($_['content']); ?>
55-
</main>
55+
</div>
5656
</div>
5757
</div>
5858
<?php

core/templates/layout.public.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</div>
8181
</header>
8282

83-
<main id="content" class="app-<?php p($_['appid']) ?>">
83+
<div id="content" class="app-<?php p($_['appid']) ?>">
8484
<h1 class="hidden-visually">
8585
<?php
8686
if (isset($template) && $template->getHeaderTitle() !== '') {
@@ -90,7 +90,8 @@
9090
} ?>
9191
</h1>
9292
<?php print_unescaped($_['content']); ?>
93-
</main>
93+
</div>
94+
9495
<?php if (isset($template) && $template->getFooterVisible() && ($theme->getLongFooter() !== '' || $_['showSimpleSignUpLink'])) { ?>
9596
<footer>
9697
<p><?php print_unescaped($theme->getLongFooter()); ?></p>

core/templates/layout.user.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@
8181
</div>
8282
</header>
8383

84-
<main id="content" class="app-<?php p($_['appid']) ?>">
84+
<div id="content" class="app-<?php p($_['appid']) ?>">
8585
<h1 class="hidden-visually" id="page-heading-level-1">
8686
<?php p((!empty($_['application']) && !empty($_['pageTitle']) && $_['application'] != $_['pageTitle'])
8787
? $_['application'] . ': ' . $_['pageTitle']
8888
: (!empty($_['pageTitle']) ? $_['pageTitle'] : $theme->getName())
8989
); ?>
9090
</h1>
9191
<?php print_unescaped($_['content']); ?>
92-
</main>
92+
</div>
9393
<div id="profiler-toolbar"></div>
9494
</body>
9595
</html>

0 commit comments

Comments
 (0)