简体   繁体   English

在 Google Chrome 中,NVDA(辅助功能屏幕阅读器)不会在 Bootstrap 模态对话框中读取文本

[英]In Google Chrome, NVDA (Accessibility Screen Reader) Does Not Read Text in Bootstrap Modal Dialog

JSFiddle : https://jsfiddle.net/jnv07akx/ JSFiddlehttps : //jsfiddle.net/jnv07akx/

I'm using the NVDA Screen Reader to test my GUI for 508/accessibility compliance.我正在使用 NVDA 屏幕阅读器来测试我的 GUI 是否符合 508/可访问性。

I have "Info Dialog" boxes created with Bootstrap Modal.我有使用 Bootstrap Modal 创建的“信息对话框”框。 In Firefox all paragraphs and elements in the dialog get read out loud when the cursor is on them, but in Chrome they do not -- there is silence when pointing at anything inside the modal.在 Firefox 中,当光标位于对话框上时,对话框中的所有段落和元素都会被大声朗读,但在Chrome 中则不然——当指向模态内的任何内容时,都会保持沉默。

First, test the modal in Firefox in the JSFiddle to verify that the modal's paragraphs/buttons work (get voiced).首先,在 Firefox 中的 JSFiddle 中测试模态以验证模态的段落/按钮是否有效(获得语音)。 Then, compare with Chrome: none of the content inside the modal works.然后,与 Chrome 进行比较:模态中的任何内容都不起作用。 The only thing that gets voiced in Chrome is the button label which is outside, not the contents of the modal.在 Chrome 中唯一能表达的就是外面的按钮标签,而不是模态的内容。

The Bootstrap Modal dialogs look like this, Bootstrap 模态对话框如下所示,

<div class="modal" id="modalGapInfoSimple" tabindex="-1" role="dialog" aria-labelledby="modalGapInfoSimpleLabel" aria-hidden="true" style="display: block;">        
        <div class="modal-dialog" role="document">
            <div class="modal-content" style="margin:0 auto;">
                <div class="modal-header" style="text-align:center;padding-bottom: 5px !important;">
                    <div style="text-align:center;">
                        <div class="modal-heading">

                            <div style="text-align: left; width: 90%;"> 

                                <h3 class="modal-title" id="modalGapInfoSimpleLabel">
                                    <div class="modalHeader">Oops you have Gaps!</div>
                                    <span class="modaltext">                                    
                                        Please edit the timeline to remove the Gaps. You can click on the Gap in your timeline and select the appropriate option presented to you in the prompt.                            
                                    </span>
                                </h3>
                            </div>
                        </div>
                        <div class="modal-body panel" style="margin-bottom: 0px !important; padding: 3px !important;">                      
                            <div class="row">
                                <div class="col-md-12 col-sm-12 col-xs-12 text-right">
                                        <div class="col-md-10 col-sm-10 col-xs-10"></div>
                                        <div class="pull-right">
                                            <input value="OK" onclick="handleModalGapInfoSimple();" class="modalButton" data-dismiss="modal" aria-label="Close" type="button">
                                        </div>                      
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>

NOTE: I entered a bug for NVDA: https://github.com/nvaccess/nvda/issues/9156注意:我为 NVDA 输入了一个错误: https : //github.com/nvaccess/nvda/issues/9156

I can't get it to work with NVDA in Firefox either.我也无法在 Firefox 中使用 NVDA。 You have aria-hidden="true" and display:block , so the dialog will be visible to sighted users but hidden to screen readers.您有aria-hidden="true"display:block ,因此该对话框对视力正常的用户可见,但对屏幕阅读器隐藏。

Remove aria-hidden .删除aria-hidden

<div class="modal" id="modalGapInfoSimple" tabindex="-1" role="dialog" aria-labelledby="modalGapInfoSimpleLabel" aria-hidden="true" style="display: block;">

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

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