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标签中公告文本


基础教程推荐
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 在for循环中使用setTimeout 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 悬停时滑动输入并停留几秒钟 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 动态更新多个选择框 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01