twitter-bootstrap – bootstrap模态关闭按钮aria-hidden = true

前端之家收集整理的这篇文章主要介绍了twitter-bootstrap – bootstrap模态关闭按钮aria-hidden = true前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
根据 the bootstrap document添加aria-hidden =“true”表示辅助技术跳过模态的DOM元素,这解释了主模态div中存在aria-hidden = true。

在模态标题div中为模态关闭按钮添加aria-hidden = true的目的是什么?

@H_502_4@<!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> **<*div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button> <h4 class="modal-title" id="myModalLabel">Modal title</h4> </div>*** <div class="modal-body"> ... </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->

解决方法

关闭按钮上隐藏的咏叹调的目的是,在该标记中,“X”或“times”符号不会告诉屏幕阅读器。

要使其可访问,关闭按钮应该如下所示:

@H_502_4@<button type="button" title="Close"> <span aria-hidden="true">&times;</span> <span class="hide">Close</span> </button>

并用CSS隐藏隐藏内容

猜你在找的Bootstrap相关文章