How to add aria-label attribute to a link in a view?
It's the dash on the label creating the problem. Try this instead:
<%= link_to t('nav.projects'),
projects_path, class: is_active('projects'),
'aria-label' => get_aria_label_current_page('home') %>
Update
In ruby 2.2 now you could do:
'aria-label': get_aria_label_current_page('home')
As of at least Rails 5.2 this works too:
<%= link_to t('nav.projects'),
projects_path,
class: is_active('projects'),
aria: { label: get_aria_label_current_page('home') } %>
This is similar to how data-*
attributes work, which is nice since you can add more than one and have them grouped.
This may work on earlier versions but I have not checked.