我可以在 html select 标签上使用 aria-required="true" 吗?
Can I use aria-required="true" on html select tag.
aria-required 属性可用于确保将必填字段正确传送给辅助技术。我可以将它用于必需的 html select 标签吗?喜欢:<select aria-required="true"><option></option></select>
在HTML5中,你可以使用aria-required
,但你必须使用required
非辅助技术用户的属性。
当你使用required
属性时,你不需要aria-required
属性(除非你想针对一些不支持HTML5的旧浏览器)。
为了给 Adam 提供参考,请参阅 official W3 spec for the <select> tag。在 "content attributes" 下它列出了所需的 属性 是有效的。因此,如果您使用 属性,那么正如 Adam 所说,您不需要使用 aria-required。
aria-required 属性可用于确保将必填字段正确传送给辅助技术。我可以将它用于必需的 html select 标签吗?喜欢:<select aria-required="true"><option></option></select>
在HTML5中,你可以使用aria-required
,但你必须使用required
非辅助技术用户的属性。
当你使用required
属性时,你不需要aria-required
属性(除非你想针对一些不支持HTML5的旧浏览器)。
为了给 Adam 提供参考,请参阅 official W3 spec for the <select> tag。在 "content attributes" 下它列出了所需的 属性 是有效的。因此,如果您使用 属性,那么正如 Adam 所说,您不需要使用 aria-required。