简体   繁体   English

引导程序导航栏按钮上的可访问性错误

[英]Accessibility error on bootstrap navbar button

The hamburger menu on a Boostrap menu is showing up in the Web Accessibility Tool, at wave.webaim.org, as an error: A button is empty or has no value text. Boostrap菜单上的汉堡包菜单显示在Web Accessibility Tool的wave.webaim.org上,显示为错误:按钮为空或没有值文本。

Any suggestions on how to fix this? 对于如何解决这个问题,有任何的建议吗?

 <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
           <span class="icon-bar"></span>
           <span class="icon-bar"></span>
           <span class="icon-bar"></span>
       </button>
 </div>

Make use of the .sr-only class. 使用.sr-only类。 Under Conveying the icon's meaning to assistive technologies (you'll have to scroll down some): 在“ 将图标的含义传达给辅助技术”下 (您必须向下滚动一些内容):

To ensure that assistive technologies – such as screen readers – correctly convey the meaning of an icon, additional hidden text should be included with the .sr-only class... 为确保辅助技术(例如屏幕阅读器)正确传达图标的含义,.sr-only类应包含其他隐藏文本...

<div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
           <span class="icon-bar"></span>
           <span class="icon-bar"></span>
           <span class="icon-bar"></span>
           <span class="sr-only">Toggle Menu</span>
       </button>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM