role="tab" 必须是 role="tablist" 的直接子代吗?

Must role="tab" be the direct child of a role="tablist"?

我有一个结构如下的手风琴:

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

选项卡是否必须是选项卡列表的直接子项才能符合 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

因此您的示例是正确的。

我建议您通读规范以确保您遵循最佳 ARIA 实践。

例如在 div 上添加 role 而不是 section 元素,as per the best practice example.