简体   繁体   English

需要使Tab和Accordion插件可访问/屏幕阅读器兼容

[英]Need to make Tab and Accordion Plugin Accessible/Screen reader compatible

I am using the following WordPress Plugins: Accordions : https://wordpress.org/plugins/responsive-accordion-and-collapse/ Tabs: https://wordpress.org/plugins/tabs-responsive/ 我正在使用以下WordPress插件:手风琴: https : //wordpress.org/plugins/sensitive-accordion-and-collapse/标签: https : //wordpress.org/plugins/tabs-sensitive/

They are having issues being read by screenreaders. 他们有屏幕阅读器正在阅读的问题。 Is there code (javascript or jQuery) I can use that will make these accessibility compliant? 我是否可以使用使这些可访问性兼容的代码(javascript或jQuery)?

Below is example code of how the tabs and accordion display on the front end HTMl. 以下是标签和手风琴如何在前端HTM1上显示的示例代码。 Please help, I do not want to go with another accordion or tab system. 请帮助,我不想使用其他手风琴或制表系统。

The website must be accessibility compliant. 该网站必须符合可访问性。

Tabs: 标签:

<div id="tab_container_3998">
  <ul class="wpsm_nav wpsm_nav-tabs" role="tablist" id="myTab_3998">
    <li role="presentation" class="">
      <a href="#tabs_desc_3998_1" aria-controls="tabs_desc_3998_1" role="tab" data-toggle="tab" aria-expanded="false">
        <span>Tab1</span>
      </a>
    </li>
    <li role="presentation" class="active">
      <a href="#tabs_desc_3998_2" aria-controls="tabs_desc_3998_2" role="tab" data-toggle="tab" aria-expanded="true">
        <span>Tab2</span>
      </a>
    </li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content" id="tab-content_3998">
    <div role="tabpanel" class="tab-pane" id="tabs_desc_3998_1">
      <h1>Title 1</h1>
      <p>This is content in a tab, <a href="http://www.google.com">please read.&nbsp;</a></p>
    </div>
    <div role="tabpanel" class="tab-pane  active animated fadeIn" id="tabs_desc_3998_2">
      <h1>Title 2</h1>
      <p>This is content in a second tab, <a href="http://www.google.com">please read.&nbsp;</a></p>
    </div>
  </div>
</div>

Accordions: 手风琴:

<div class="wpsm_panel-group" id="wpsm_accordion_3995">
  <!-- Inner panel Start -->
  <div class="wpsm_panel wpsm_panel-default">
    <div class="wpsm_panel-heading acc-a" role="tab">
      <h4 class="wpsm_panel-title">
        <a class="" data-toggle="collapse" data-parent="#wpsm_accordion_3995 " href="#ac_3995_collapse1" aria-expanded="true">
          <span class="ac_open_cl_icon fa fa-minus"></span>
          <span class="ac_title_class">
            Accordion Title 1 </span>
        </a>
      </h4>
    </div>
    <div id="ac_3995_collapse1" class="wpsm_panel-collapse collapse show in" style="" aria-expanded="true">
      <div class="wpsm_panel-body">
        <h1>Title 1</h1>
        <p>This is content in an accordion <a href="http://www.google.com">please read.&nbsp;</a></p>
      </div>
    </div>
  </div>
  <!-- Inner panel End -->
</div>

The screen readers don't read the accordions open or closed and don't read the second or third tabs. 屏幕阅读器不会阅读打开或关闭的手风琴,也不会阅读第二个或第三个标签。

The tab code looks ok. 选项卡代码看起来还可以。 It follows the pattern on the " WAI-ARIA Authoring Practices 1.1 ". 它遵循“ WAI-ARIA创作惯例1.1 ”中的模式。 What is not working with it? 什么不起作用呢?

The accordion code looks a bit wonky. 手风琴代码看起来有些古怪。 There are accordion recommendations in the authoring practices too. 在创作实践中也有手风琴建议 The accordion shouldn't have any "tab" roles and aria-expanded should only be set on the button that does the expanding. 手风琴不应具有任何“制表符”角色,并且只能aria-expanded的按钮上设置aria-expanded扩展。 Remove it from the accordion panel. 从手风琴面板上将其删除。

Both the Tab example and Accordion example should toggle the value of aria-expanded between true/false as the user selects the appropriate button. 当用户选择适当的按钮时,“ Tab”示例和“手风琴”示例都应在aria-expanded值之间切换true / false。

Also, the tab that has aria-expanded set to true also needs aria-selected set to true. 此外,将aria-expanded设置为true的选项卡也需要将aria-selected设置为true。

This is all documented in the authoring practices links above. 所有这些都记录在上面的创作惯例链接中。

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

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