Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing author requirement for use of tabs? #2497

Open
scottaohara opened this issue Mar 26, 2025 · 4 comments · May be fixed by #2500
Open

Missing author requirement for use of tabs? #2497

scottaohara opened this issue Mar 26, 2025 · 4 comments · May be fixed by #2500
Assignees

Comments

@scottaohara
Copy link
Member

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).

@aardrian
Copy link
Contributor

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.

scottaohara added a commit that referenced this issue Mar 27, 2025
… rendered

closes #2497 initial stab at creating the new author must requirement so that if there is an activate tab, a corresponding tabpanel element must be rendered.

question is should this requirement be copied over to tabpanel as well?  i assume yes, but will wait to be told that before i add in more dupe content between these rules.
@scottaohara scottaohara self-assigned this Mar 28, 2025
@MarioBatusic
Copy link
Contributor

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

@scottaohara
Copy link
Member Author

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

@spectranaut
Copy link
Contributor

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

@spectranaut spectranaut removed the Agenda label Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants