iOS Voice Over and Android Fail to Announce Text In Span Tag(iOS Voice Over和Android无法在Span标签中公告文本)
问题描述
我们希望在节点关闭后,屏幕阅读器会宣布";项已关闭";。有趣的是,Chrome上的NVDA正确地宣布了这一消息,而Android和iOS Voice Over却没有宣布这一消息。
以下是打字代码:
@HostListener('keydown.tab', ['$event'])
removeFilterMsg() {
const $message = document.createElement('span');
$message.classList.add('RemoveFilter');
$message.setAttribute('aria-live', 'assertive');
$message.setAttribute('display', 'none');
window.setTimeout(() => {
$message.innerHTML = "Filter item is removed";
}, 100);
document.body.appendChild($message);
}
触发上述函数的html代码为:
<button attr.aria-label="School Name" class="active-node" title="School Name">
School Name
<span style="color:white;font-size:20px;cursor:pointer;" aria-hidden="true" (click)="removeFilterMsg()"></span>
</button>
并且此代码将在正文底部生成跨区部分。
<span class="RemoveFilter" aria-live="assertive" display="none">Filter item is removed</span>
有人知道问题出在哪里吗?
推荐答案
您没有正确使用aria-live。我最近写了一篇很长的关于aria-live的回答。您可以在Snackbars not read by screen reader when triggered from a dialog
实质上,您需要在加载时间时页面上有一个aria-live元素。aria-live既不是动态属性,也不是动态添加到DOM中。Chrome很友好,宣布了新添加的活动区域,但你听到这个消息就很幸运了。
这篇关于iOS Voice Over和Android无法在Span标签中公告文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS Voice Over和Android无法在Span标签中公告文本
基础教程推荐
- 使用 jQuery 在悬停时交换 DIV 类 2022-01-01
- 即使每次插入第一个输入的值不同,第二个输入仍显示相同的输入值 2022-01-01
- 从快速中间件中排除路由 2022-01-01
- 最佳动态 JavaScript/JQuery 网格 2022-01-01
- 在 Javascript 中使用 Fetch API 上传文件并显示进度 2022-01-01
- 逻辑运算符 ||在 javascript 中,0 代表 Boolean false? 2022-01-01
- HTML5 画布调整为父级 2022-01-01
- 带角度的选项卡:仅使用 $http 在单击时加载选项卡 2022-01-01
- 当木偶师打开Chrome时,不能使用Chrome扩展 2022-01-01
- CORS:当凭据标志为真时,无法在 Access-Control-Allow-Origin 中使用通配符 2022-01-01
