fix aria-label of notification count

This commit is contained in:
Nolan Lawson 2018-02-15 22:58:18 -08:00
parent 2d640945a3
commit f45d1d53fb

View file

@ -1,7 +1,7 @@
<a class='main-nav-link {{forceCurrent || page === name ? "selected" : ""}}' <a class='main-nav-link {{page === name ? "selected" : ""}}'
aria-label='{{forceCurrent || page === name ? `${label} (current page)` : label}}' aria-label='{{ariaLabel}}'
aria-current="{{forceCurrent || page === name}}" aria-current="{{page === name}}"
href='{{href}}'> :href >
{{#if name === 'notifications'}} {{#if name === 'notifications'}}
<div class="nav-link-svg-wrapper"> <div class="nav-link-svg-wrapper">
<svg> <svg>
@ -115,6 +115,16 @@
export default { export default {
store: () => store, store: () => store,
computed: { computed: {
ariaLabel: (page, name, label, numberOfNotifications) => {
let res = label
if (page === name) {
res += ' (current page)'
}
if (name === 'notifications') {
res += ` (${numberOfNotifications})`
}
return res
},
numberOfNotifications: ($timelines, $currentInstance, $currentTimeline) => { numberOfNotifications: ($timelines, $currentInstance, $currentTimeline) => {
return $currentTimeline !== 'notifications' && return $currentTimeline !== 'notifications' &&
$timelines && $timelines &&