简体   繁体   English

角色=“制表符”必须是角色=“制表符”的直接子代吗?

[英]Must role=“tab” be the direct child of a role=“tablist”?

I have an accordion which is structured like: 我有一个手风琴,其结构如下:

<section... role="tablist">
  <div>
    <h3 role="tab">Title</h3>
    <div role="tabpanel">
    ...
    </div>
  </div>
</section>

Does tab have to be a direct child of the tablist to conform to wai aria best practices or is it okay to be wrapped in a div? tab是否必须是tablist的直接子对象才能符合wai aria最佳做法,还是可以将其包装在div中?

Authors MUST ensure elements with role tab are contained in, or owned by, an element with the role tablist. 作者必须确保具有角色选项卡的元素包含在具有角色选项卡列表的元素中或由其拥有。

https://www.w3.org/TR/wai-aria-1.1/#tab https://www.w3.org/TR/wai-aria-1.1/#tab

Your example is therefore correct. 因此,您的示例是正确的。

I would suggest you read through the spec to ensure you are following best ARIA practice. 我建议您通读规范,以确保遵循最佳ARIA做法。

For example adding the role on a div as opposed to a section element, as per the best practice example . 例如, 根据最佳做法示例 ,在div上添加一个与section元素相对的div role

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复 role=&quot;tablist&quot;/role=&quot;tab&quot; Ax 违规? - How to fix role="tablist"/role="tab" Axe violations? 可访问的手风琴角色(标签和标签列表) - Accessible accordion roles (tab and tablist) aria role="application" 和制表符 - aria role=“application” and tab-trapping 如何将 role="listbox" 与非直系后代的 role="option" 子代一起使用? - How to use role="listbox" with role="option" children that aren't direct descendants? combobox 是否需要具有文本框角色的子元素? - Does a combobox require a child element with the role of textbox? html / head / body中的“ ARIA角色必须适合该元素” - “ARIA role must be appropriate for the element” on html/head/body 无法为 mydatepicker 插入角色或动态更新选项卡索引 - Unable to insert the role or Update the tab index dynamically for mydatepicker 当仅当前活动的选项卡包含在 DOM 中时,选项卡容器的正确角色是什么? - What is the correct role for a tab container when only the currently active tab is included in the DOM? 角色=“组”在角色=“树”下是否有效 - Is a role=“group” valid under a role=“tree” 带有角色按钮的锚链接内图像的可访问性:可点击元素必须是可聚焦的并且应该具有交互式语义 - accessibility for image inside an anchor link with role button: Clickable elements must be focusable and should have interactive semantics
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM