♿️ Add header and main menu nav landmarks (#3048)

Wrap the page header in a header element and the subnavigation menu in
a labelled nav landmark. Addresses #3023.

Co-authored-by: Chris Herborth <chrish@taffer.ca>
This commit is contained in:
Nuno C.andChris Herborth authored and GitHub committed 2026-08-16 22:09:35 +01:00
1 parent 3ea1c3b49f
commit 74d03343b9
3 files changed
+33 -28

No files matched your search

+1
View File
@@ -60,6 +60,7 @@ list:
no_articles: "There are no articles to list here yet."
nav:
main_menu: "Main menu"
scroll_to_top_title: "Scroll to top"
skip_to_main: "Skip to main content"
+8 -6
View File
@@ -19,12 +19,14 @@
{{ i18n "nav.skip_to_main" }}
</a>
</div>
{{ $header := print "header/" site.Params.header.layout ".html" }}
{{ if templates.Exists ( printf "partials/%s" $header ) }}
{{ partial $header . }}
{{ else }}
{{ partial "header/basic.html" . }}
{{ end }}
<header>
{{ $header := print "header/" site.Params.header.layout ".html" }}
{{ if templates.Exists ( printf "partials/%s" $header ) }}
{{ partial $header . }}
{{ else }}
{{ partial "header/basic.html" . }}
{{ end }}
</header>
<div class="relative flex flex-col grow">
<main id="main-content" class="grow">
{{ block "main" . }}{{ end }}
+24 -22
View File
@@ -37,30 +37,32 @@
</div>
{{ if .Site.Menus.subnavigation }}
<div
class="main-menu flex pb-3 flex-col items-end justify-between md:justify-start space-x-3 {{ if .Site.Params.Logo }}
-mt-[15px]
{{ end }}">
<div class="hidden md:flex items-center space-x-5">
{{ range .Site.Menus.subnavigation }}
<a
href="{{ .URL }}"
{{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }}
target="_blank"
{{ end }}
class="flex items-center bf-icon-color-hover">
{{ if .Pre }}
<span {{ if and .Pre .Name }}class="mr-1"{{ end }}>
{{ partial "icon.html" .Pre }}
<nav id="main-menu" aria-label="{{ i18n "nav.main_menu" }}">
<div
class="main-menu flex pb-3 flex-col items-end justify-between md:justify-start space-x-3 {{ if .Site.Params.Logo }}
-mt-[15px]
{{ end }}">
<div class="hidden md:flex items-center space-x-5">
{{ range .Site.Menus.subnavigation }}
<a
href="{{ .URL }}"
{{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }}
target="_blank"
{{ end }}
class="flex items-center bf-icon-color-hover">
{{ if .Pre }}
<span {{ if and .Pre .Name }}class="mr-1"{{ end }}>
{{ partial "icon.html" .Pre }}
</span>
{{ end }}
<span class="text-xs font-light" title="{{ .Title }}">
{{ .Name | markdownify }}
</span>
{{ end }}
<span class="text-xs font-light" title="{{ .Title }}">
{{ .Name | markdownify }}
</span>
</a>
{{ end }}
</a>
{{ end }}
</div>
</div>
</div>
</nav>
{{ end }}
{{ if .Site.Params.highlightCurrentMenuArea }}