简体   繁体   English

为Twitter Bootstrap手风琴添加Web可访问性

[英]Adding web accessibility to twitter bootstrap accordion

I trying to add Keyboard Navigation to Twitter bootstrap accordion to enable web accessibility, Similar to http://hanshillen.github.io/jqtest/#goto_accordion . 我试图将键盘导航添加到Twitter引导手风琴以启用Web可访问性,类似于http://hanshillen.github.io/jqtest/#goto_accordion

I couldn't do the following: 我无法执行以下操作:

  1. Once the focus is on Accordion Tabs, I couldn't just navigate accordion header. 一旦将焦点放在“手风琴选项卡”上,我就无法浏览手风琴标题。 When I hit tab, it navigates the all inner links in the group, then to the next heading. 当我点击选项卡时,它将导航组中的所有内部链接,然后导航至下一个标题。
  2. I couldn't use up/down arrow keys 我无法使用向上/向下箭头键
  3. After last accordion header tab thro', focus shifts outside the accordion. 在最后一个手风琴头选项卡通过之后,焦点移到手风琴之外。

Link to page 链接到页面

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Getting Started</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

</head>

<body>
<div class="row-fluid" id="main">
<div class="container">
  <div class="row-fluid">
    <div class="gutter10">
      <div class="row-fluid">
        <div class="span3" id="sidebar">
          <div class="selections">
            <h4 class="graydrkbg">Hello</h4>
          </div>
        </div>
        <!--sidebar-->
        <div class="span9" id="rightpanel">
            <div class="gutter10">
                <div class="accordion" id="accordion2">
                    <div class="accordion-group">
                        <div class="accordion-heading">
                            <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
                                Collapsible Group Item #1
                            </a>
                        </div>
                        <div id="collapseOne" class="accordion-body collapse in">
                            <div class="accordion-inner">
                                <p>
                                    <a href="http://en.wikipedia.org/wiki/Dogs" class="">More information about Dogs on Wikipedia</a>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="accordion-group">
                        <div class="accordion-heading">
                            <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
                                Collapsible Group Item #2
                            </a>
                        </div>
                        <div id="collapseTwo" class="accordion-body collapse">
                            <div class="accordion-inner">
                                <p>Anim pariatur cliche...</p>
                                <p>
                                    <a href="http://en.wikipedia.org/wiki/Dogs" class="">More information about Dogs on Wikipedia</a>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div><!--gutter10--> 
        </div><!--rightpanel--> 
      </div><!--row-fluid-->
    </div><!--gutter10-->
    <!--container--> 
</div><!--main--> 


<!--footer-->
<script src="../js/jquery-1.7.2.min.js" type="text/javascript"></script> 
<script src="../js/bootstrap.js" type="text/javascript"></script> 
</body>
</html>

So here is what I am going to do for lack of a better solution: 因此,由于缺少更好的解决方案,我将要执行以下操作:

To .collapse I will add a display:none; .collapse我将添加display:none; This will hide it from sighted users as well as screen readers. 这会将它对可见的用户以及屏幕阅读器隐藏。 Then to .in I'll add display:block; 然后在.in添加display:block; , which will make it visible to both again. ,这将使其再次对双方都可见。 So then, it skips the content in the tab order when closed, and adds it back when open. 因此,当关闭时,它会按选项卡顺序跳过内容,并在打开时将其重新添加。

so: 所以:

    .collapse {
       display:none;
    }

    .in{
       display:block;
    }

I haven't tested on screen reader yet, but I think it should work for down-arrow back into reading text. 我尚未在屏幕阅读器上进行过测试,但我认为它应该可以向下箭头返回以阅读文本。 I'll update if not. 如果没有,我会更新。

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

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