【发布时间】:2018-10-29 19:30:58
【问题描述】:
在阅读页面时,Chromevox 和 Voice Over(我没有 JAWS 或 NVDA)似乎会跳过 <fieldset> 的内部元素。在下面的示例 HTML 中,有一个按钮可用于关注 <main id="content" tabindex="-1"> 元素:
<html lang="en">
<head><script>
function focusOnContent() {
document.getElementById('content').focus()
}
</script></head>
<body>
<button onclick="focusOnContent()">Focus on main</button>
<main id="content" tabindex="-1">
<h1>User Sign-up</h1>
<fieldset>
<legend>Name</legend>
<label for="firstname">First</label>
<input type='text' id='firstname'><br>
<label for="lastname">Last</label>
<input type='text' id='lastname'>
</fieldset>
<button>Submit</button>
</main>
</body>
</html>
当点击<main> 元素获得焦点并且屏幕阅读器说:
用户注册、姓名、提交
但是,我希望这样理解
用户注册、姓名、名字、姓氏、提交
删除 <fieldset> 元素可以解决问题,但显然我想保留它,因为它可以解决其他可访问性问题。
【问题讨论】:
标签: html forms accessibility screen-readers fieldset