aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrack3 <pengliabc@live.cn>2018-12-31 15:20:34 +0800
committerTrack3 <pengliabc@live.cn>2018-12-31 15:20:34 +0800
commit97395d876cce68513dc29416cec937a32765df15 (patch)
tree84284f2c6dbb9888390b17a13ee5ee2afdd6d83c
parent1e25d7d93ed24a671ed87da7ce6a98865a1cb3cb (diff)
downloadhermit-97395d876cce68513dc29416cec937a32765df15.tar.gz
Slightly improve accessibility
* Add `title` attribute to some buttons or icons
-rw-r--r--i18n/en.toml8
-rw-r--r--i18n/zh-hans.toml8
-rw-r--r--layouts/partials/header.html6
-rw-r--r--layouts/partials/social-icons.html2
4 files changed, 20 insertions, 4 deletions
diff --git a/i18n/en.toml b/i18n/en.toml
index de033a9..1b09bfc 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -25,3 +25,11 @@ other = "Newer"
[older]
other = "Older"
+
+# partials/header.html
+#
+[menu]
+other = "Menu"
+
+[featuredImage]
+other = "Featured Image"
diff --git a/i18n/zh-hans.toml b/i18n/zh-hans.toml
index eddd8ba..8884b93 100644
--- a/i18n/zh-hans.toml
+++ b/i18n/zh-hans.toml
@@ -25,3 +25,11 @@ other = "新"
[older]
other = "旧"
+
+# partials/header.html
+#
+[menu]
+other = "菜单"
+
+[featuredImage]
+other = "特色图片"
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index ae1a9a8..9eb24f2 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -12,15 +12,15 @@
</div>
<div class="hdr-right hdr-icons">
{{ with .Params.featuredImg -}}
- <button class="hdr-btn" onclick="showFeaturedImg()"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></button>
+ <button class="hdr-btn" onclick="showFeaturedImg()" title="{{i18n "featuredImage"}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></button>
{{- end }}
{{- with .Params.toc -}}
- <button class="hdr-btn desktop-only-ib" onclick="toggleToc()"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-list"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3" y2="6"></line><line x1="3" y1="12" x2="3" y2="12"></line><line x1="3" y1="18" x2="3" y2="18"></line></svg></button>
+ <button class="hdr-btn desktop-only-ib" onclick="toggleToc()" title="{{i18n "tableOfContents"}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-list"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3" y2="6"></line><line x1="3" y1="12" x2="3" y2="12"></line><line x1="3" y1="18" x2="3" y2="18"></line></svg></button>
{{- end }}
{{- with .Site.Params.social -}}
<span class="hdr-social hide-in-mobile">{{ partialCached "social-icons.html" . }}</span>
{{- end -}}
- <button id="menu-btn" class="hdr-btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>
+ <button id="menu-btn" class="hdr-btn" title="{{i18n "menu"}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>
</div>
</div>
</header>
diff --git a/layouts/partials/social-icons.html b/layouts/partials/social-icons.html
index 5df3d55..5c4282a 100644
--- a/layouts/partials/social-icons.html
+++ b/layouts/partials/social-icons.html
@@ -1,3 +1,3 @@
{{ range . -}}
-<a href="{{ .url }}" target="_blank" rel="noopener">{{ partial "svg.html" . }}</a>
+<a href="{{ .url }}" target="_blank" rel="noopener" title="{{ .name | humanize }}">{{ partial "svg.html" . }}</a>
{{- end -}}