出于可访问性目的,我需要在页面刷新后立即读取显示的“错误”。
目前我在包含错误的 div 上有 role="alert" 和 tabindex="-1'。这在 Google Chrome 中运行良好,但似乎 IE 或 Firefox 都不支持我所做的。
在 Chrome 中,用户会看到一个包含用户名/密码字段的登录页面。用户“提交”表单而不填写任何信息。页面刷新并显示以下错误,NVDA 立即读取该错误。(我知道实时验证会很好,但这将在以后完成)
<div id="notification_block">
<div class="alert alert-danger" role="alert" aria-labelledby="alertHeading" tabindex="-1">
<h2 id="alertHeading">Error: Login Failed</h2>
<div>Invalid username/password combination. Please verify that your information is correct.</div>
</div>
</div>
有什么想法可以让它在 IE 和 Firefox 中工作吗?