fix(sidebar): improve accessibility of sidebar bottom menu (#925)

* fix(menu): <ol> containing other than <li>, <script> or <template> elements

* fix(menu): add title to language select menu
This commit is contained in:
Jiahao Li 2024-03-03 00:48:34 +02:00 committed by GitHub
parent 65cd7f586f
commit 5b0d6fdf7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,14 +74,15 @@
</a> </a>
</li> </li>
{{ end }} {{ end }}
</ol>
<div class="menu-bottom-section"> <div class="menu-bottom-section">
<ol class="menu">
{{- $currentLanguageCode := .Language.Lang -}} {{- $currentLanguageCode := .Language.Lang -}}
{{ if ( compare.Gt .Site.Home.AllTranslations.Len 1 ) }} {{ if ( compare.Gt .Site.Home.AllTranslations.Len 1 ) }}
{{ with .Site.Home.AllTranslations }} {{ with .Site.Home.AllTranslations }}
<li id="i18n-switch"> <li id="i18n-switch">
{{ partial "helper/icon" "language" }} {{ partial "helper/icon" "language" }}
<select name="language" onchange="window.location.href = this.selectedOptions[0].value"> <select name="language" title="language" onchange="window.location.href = this.selectedOptions[0].value">
{{ range . }} {{ range . }}
<option value="{{ .Permalink }}" {{ if eq .Language.Lang $currentLanguageCode }}selected{{ end }}>{{ .Language.LanguageName }}</option> <option value="{{ .Permalink }}" {{ if eq .Language.Lang $currentLanguageCode }}selected{{ end }}>{{ .Language.LanguageName }}</option>
{{ end }} {{ end }}
@ -97,6 +98,6 @@
<span>{{ T "darkMode" }}</span> <span>{{ T "darkMode" }}</span>
</li> </li>
{{ end }} {{ end }}
</div>
</ol> </ol>
</div>
</aside> </aside>