Web可访问性屏幕阅读器未读取JavaScript弹出对话框

时间:2015-06-16 21:14:15

标签: javascript jquery html accessibility uiaccessibility

我有一个项目要求,我正在构建的网页需要由JAWS屏幕阅读软件读取,但客户端只能访问JAWS 11作为其最新版本。

我们目前为网络上的许多表单提供基于JavaScript的弹出对话框,现在一个大问题是JAWS 11软件无法读取下面的弹出文本。下面的弹出式对话框(用HTML格式)有什么问题?

<div class="modal fade" id="EditContentModal" tabindex="-1" role="dialog" aria-labelledby="editContentDialogTitle" 
aria-hidden="true" title="Edit Content Pop-up Dialog Window" aria-describedby="editContentDialogTitle">
    <div class="modal-dialog"  >
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" value="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="editContentDialogTitle">Edit: Content ID <span id="lblContentid"></span></h4>
            </div>

            <div class="modal-body">
                <div class='row'>
                    <div class='col-md-8'>
                        <div class='form-group'>
                            <label for="edit_Contentnumber">Content Number</label>
                            <input type="text" class="form-control" max-length="20" id="edit_Contentnumber" />
                        </div>
                    </div>
                </div>
                <div class='row'>
                    <div class='col-md-8'>
                        <div class='form-group'>
                            <label for="edit_Educationalinsitution">Educational Insitution</label>
                            <input type="text" class="form-control" max-length="100" id="edit_Educationalinsitution" />
                        </div>
                    </div>
                </div>
                 <div class='row'>
                    <div class='col-md-8'>
                        <div class='form-group'>
                            <label for="edit_TotalAmountforRecovery">Total Amount Available for Recovery</label>
                            <input type="text" class="money form-control" max-length="10" id="edit_TotalAmountforRecovery" />
                        </div>
                    </div>
                </div>
                <div class='row'>
                    <div class='col-md-8'>
                        <div class='form-group'>
                            <label for="edit_source">Source</label>
                            <select id="edit_source" class="form-control"></select>
                        </div>
                    </div>
                </div>
                <div class='row'>
                    <div class='col-md-8'>
                         <div class='form-group'>
                            <label for="edit_indemletterdate">Indemnification Letter Date</label>
                            <input type="text" class="form-control datepicker" id="edit_indemletterdate" />
                        </div>
                    </div>
                </div>
                <div class='row'>
                    <div class='col-md-8'>
                        <div class='form-group'>
                            <label for="edit_Contentreceiveddate">Content Received Date</label>
                            <input type="text" class="form-control datepicker" id="edit_Contentreceiveddate" />
                        </div>
                    </div>
                </div>
                <div class='row'>
                    <div class='col-md-8'>
                        <div class='form-group'>
                            <label for="edit_site">Site</label>
                            <select id="edit_site" class="form-control">
                            </select>
                            @*<input type="text" class="form-control" max-length="10" id="edit_site" />*@
                        </div>
                    </div>
                </div>
                <div class='row'>
                    <div class='col-md-8'>
                        <div class='form-group'>
                            <label for="edit_status">Status</label>
                            <select id="edit_status" class="form-control">
                            </select>
                        </div>
                    </div>
                </div>

                <input type="hidden" id="edit_Contentid" />
                <img id="displayBlockUI" alt="Spinner" src="~/Images/loader2.gif" width="32" height="32" style="display:none" />
            </div>
            <div class="modal-footer">
                <button type="button" id="cancel_edit" class="btn btn-default" data-dismiss="modal" value="Close">Close</button>
                <button type="button" id="save_edit" class="btn btn-primary" value="Save">Save</button>
            </div>
        </div>
    </div>
</div>

2 个答案:

答案 0 :(得分:2)

将主要内容设置为aria-hidden ='true'告诉屏幕阅读器停止在此处阅读内容。

尝试使用aria-hidden ='false'

答案 1 :(得分:-1)

你是如何打开模态的?因为在包装器div上tabindex为-1,您只能通过JavaScript将屏幕阅读器和键盘焦点发送到模态。在这种情况下,最好移动打开模态的脚本的焦点部分。

另一方面,如果通过链接打开它,你可以完全删除tabindex属性,并将包装div的id放在链接href中,例如 @IBAction func start(sender: AnyObject) { if !timer.valid{ let aSelector : Selector = "updateTime" timer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: aSelector, userInfo: nil, repeats: true) startTime = NSDate.timeIntervalSinceReferenceDate() } } @IBAction func stop(sender: AnyObject) { timer.invalidate() }

无论哪种方式,请记住将焦点发送回模态关闭时的焦点。

编辑澄清: tabindex =&#34; -1&#34;您的包装器div上的属性阻止了键盘访问。去掉它。请参阅MDN's tabindex reference:负值表示该元素应该是可聚焦的,但不应通过顺序键盘导航访问。