Ruby on Rails:如何使用link_to添加“aria-hidden ='true'”?

5

我该如何用Rails语法编写这段代码?

<a href="/" class="glyphicon glyphicon-fire logo" aria-hidden="true" ></a>

可能是类似这样的内容:
<%= link_to '', root_path, class: 'glyphicon glyphicon-fire logo', **???** %>
2个回答

11
<%= link_to '', root_path, ...., 'aria-hidden' => true %>
或者
<%= link_to '', root_path, ...., aria: {hidden: true} %>

谢谢,这个可以用!不幸的是我现在还不能给你点赞。 - Pascal
我没有测试过它.. +1 - Arup Rakshit

0
尝试这个解决方案:
<%= link_to "", root_path, class: 'glyphicon glyphicon-fire logo', "aria-hidden" => true %>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接