简体   繁体   English

JAWS不会读取Aria-Live =“ Assertive”

[英]Aria-Live=“Assertive” is not read by JAWS

Hello Stackoverflow community. 您好Stackoverflow社区。 This is my first question, but I will try to be as concise and detailed as possible. 这是我的第一个问题,但我会尽量简洁明了。

I have been tasked with updating our ASP.NET web applications to be section 508 compliant. 我的任务是将我们的ASP.NET Web应用程序更新为符合508节。 This is all very new to me, and I'm having trouble getting things to work as expected. 这对我来说是非常陌生的,而且我无法按预期工作。

We have a page where the user gets additional information about a link via an onmouseover event. 我们有一个页面,用户可以通过onmouseover事件获取有关链接的其他信息。 Obviously this doesn't work for non-sighted users. 显然,这对于没有视力的用户不起作用。 So we are providing them with a "More information" button that displays the same "tooltip" div that the sighted user gets. 因此,我们为他们提供了一个“更多信息”按钮,该按钮显示了有视力的用户所获得的“工具提示” div。

I added aria-live="assertive to the "tooltip" div with the understanding that if the div was hidden when the page loads and then shown via the button, it would be read by JAWS. To my dismay, this wasn't the case. 我向“ tooltip” div添加了aria-live="assertive ,但要理解的是,如果在页面加载时div被隐藏,然后通过按钮显示,则JAWS会读取它。令我沮丧的是,这不是案件。

The tooltip div looks like this: 工具提示div如下所示:

<div id='tooltip' aria-live='assertive' style='display:none;'>
    <span id='tooltip_message'>This is my tooltip text</span>
</div>

It is shown via the click event of the button with the following JavaScript code: 通过带有以下JavaScript代码的按钮的click事件显示它:

function ShowTooltip(ttID)
{
  var tt = $('#' + ttID);   
  tt.css('display', '');
}

The button to show the tooltip div looks like this: 显示工具提示div的按钮如下所示:

<button id='ttBtn' onclick="ShowToolTip('tooltip'); return false;">
    More information
</button>

I had success getting JAWS to read the tooltip by adding role="alert" to the tooltip div, but I'd like to avoid using the alert role for non-alert purposes. 通过在工具提示div中添加role =“ alert”,我成功地让JAWS读取了工具提示,但是我想避免将警报角色用于非警告目的。 Mainly because it reads "Alert, this is my tooltip text." 主要是因为它显示为“警告,这是我的工具提示文字”。 to the user. 给用户。

I'd like to know what is the proper method to get jaws to read the tooltip when it becomes visible? 我想知道什么是使下巴在可见时读取工具提示的正确方法?

I am using IE 11 and JAWS 16. Internet Explorer and JAWS are requirements that I cannot change. 我正在使用IE 11和JAWS16。InternetExplorer和JAWS是我无法更改的要求。

Thanks! 谢谢! -Ray -射线

UPDATE 更新

I thought I'd post the solution we used in case others have the same problem. 我以为我会发布我们使用的解决方案,以防其他人遇到相同的问题。 This is a simplified version of our code that shows just what's necessary to get the tooltip visible and read when it is displayed. 这是我们代码的简化版本,显示了使工具提示可见并在显示时读取的必要条件。 This is a server control, so many of the ID's are based off of the control's ClientID property and have known suffixes (_tootip, _tooltipcontainer, etc.) 这是一个服务器控件,因此许多ID都基于控件的ClientID属性,并且具有已知的后缀(_tootip,_tooltipcontainer等)。

JavaScript: JavaScript:

 //handles showing/hiding of the tooltip
 function ShowToolTip(ttID)
 {
    var tt = $('#' + ttID + '_ToolTip');    
    var ttContainer = $('#' + ttID + '_ToolTipContainer');  

    var ttClone = tt.clone();
    tt.remove(); 
    ttClone.css('display', '');
    ttContainer.append(ttClone);
}

//Closes the tooltip and returns focus to the hidden (from sighted users) button that shows it.
function CloseToolTip(ttID)
{     
    var tt = $('#' + ttID + '_ToolTip');                   
    tt.css('display', 'none');
}";

Markup: 标记:

<button id="tooltip1_508KeyboardButton" class="hidden" onclick="ShowToolTip('tooltip1'); return false;" onblur="CloseToolTip('tooltip1');">Click for overview</button>

<div id='tooltip1_ToolTipContainer' aria-live='polite' aria-atomic='true'>
    <div id='tooltip1_ToolTip' class='section tooltip' style='display:none;'>
        <span id='tooltip1_Msg'>This is my tooltip's text.</span>
   </div>
</div>

I hope this is of use to someone in the future. 我希望这对将来的某人有用。 As I think about it, I could have easily placed an aria-live region that stays visible somewhere off screen that changes it's text when the tooltip is "shown". 当我想到它时,我本可以轻松地放置一个咏叹调活动的区域,该区域在屏幕外的某个地方仍然可见,当工具提示为“显示”时会更改其文本。 So there are many ways to skin this particular cat. 因此,有很多方法可以使这只猫变皮。

As a quick hack, the following seems to work for me with IE11 + JAWS 15 作为一个快速技巧,以下内容似乎对我来说适用于IE11 + JAWS 15

function ShowTooltip(ttID)
{
  setTimeout(function(){
    $('#' + ttID).css('display', 'block');
  }, 100)
}

You could also try the following: 您还可以尝试以下操作:

  • Push the text of your tooltips to an aria-live region that is always available "on screen" to screen readers 将您的工具提示文字推到一个实时显示的咏叹调区域, 屏幕阅读器始终在屏幕上可用
  • Shift the user's focus dynamically to the tooltip. 动态将用户的焦点移至工具提示。 (I'd be very careful about doing this, though. It can be confusing to your users.) (不过,我会非常谨慎地执行此操作。这可能会使您的用户感到困惑。)

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

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