- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我注意到在所有使用 button
元素的 Bootstrap 示例中,它们包括 role="button"
(和 type="button"
),例如:
<div class="dropdown">
<button id="dLabel" type="button" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Dropdown trigger <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
...
</ul>
</div>
无障碍软件是否已经知道 button
元素是用来充当按钮的?我有什么理由应该在我的代码中包含 role="button"
和/或 type="button"
吗?
最佳答案
许多 HTML5 元素都带有默认的隐式 ARIA 语义,并且显式设置这些默认值是“unnecessary and not recommended”。
查看 button
element ,你可以看到它有 button
role默认情况下。
因此,设置 role="button"
是“不推荐”的,但是允许的。它可能帮助支持 WAI-ARIA 但不支持 HTML5 的旧用户代理。
关于html - <button> 需要角色 ="button"吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26934719/
我遇到过这个 html: 上面的html和这个有什么区别: 最佳答案 来自MDN page on the tag : 对于 type 的属性标签,可能的值是: 提交:按钮将表单数据提交给服务器
Button button= (Button) findViewbyID(R.id.button); 和 Button button = new Button(this); 有什么区别? 最佳答案 有
我是一名优秀的程序员,十分优秀!