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标签中公告文本
基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
