aria icon indicating copy to clipboard operation
aria copied to clipboard

Missing author requirement for use of tabs?

Open scottaohara opened this issue 8 months ago • 1 comments

Consider the following markup:

<div role=tablist>
  <button role=tab aria-selected=false>foo</button>
  <button role=tab aria-selected=true>bar</button>
</div>

<article>
  bar content goes here
</article>

running a bunch of automated checkers, no issue is raised that there is no association between the selected tab and its content. which is not unexpected, since the aria spec says authors SHOULD ensure there's an association between the currently active tab and tabpanel.

But, the issue here is there's no explicit role=tabpanel element at all, and from my reading of the spec it seems more of an "well if you're creating a tab widget of course you would mark elements as tab panels" - but there is no overt author requirement to do so.

Is this a gap? Or, is there an unstated opportunity for a tablist to not just be used for showing/hiding tabpanels - but other non-tabpanel content as well? (i say this not because i think it's a good idea, but as the only logical explanation i can think of for why there is no overt requirement that if someone implements tabs within a tablist - that they could reasonably no also be required to declare at least one element in the UI as a tabpanel).

scottaohara avatar Mar 26 '25 17:03 scottaohara

No kidding last night I was looking at the 2016 flurry of activity from a WHATWG issue for <tabsection>, <tablist>, <tab>, <tabpanel>, the proposed Panels and Panel Sets Extension, and related WICG discussions on the latter, and those conversations included ideas for what I think you have rightly identified as a gap.

aardrian avatar Mar 26 '25 18:03 aardrian

IMO a selected tab without a rendered tabpanel and vice versa make no sense and this should be an authoring MUST.

MarioBatusic avatar Apr 03 '25 11:04 MarioBatusic

Well that’s what the pr I made says. Maybe give that a look if you want to check the wording.

scottaohara avatar Apr 03 '25 11:04 scottaohara

Minutes from last week: https://www.w3.org/2025/04/03-aria-minutes.html#bca0

spectranaut avatar Apr 08 '25 17:04 spectranaut