w3c / aria-practices

WAI-ARIA Authoring Practices Guide (APG)
https://www.w3.org/wai/aria/apg/
Other
1.21k stars 344 forks source link

Should tablist be a `ul` element? #1118

Open lkmorlan opened 5 years ago

lkmorlan commented 5 years ago

In the tabpanel examples: https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-2/tabs.html

role="tablist" is applied to a div element. It seems to me that since this is a list of tabs, it ought to be a ul element. Is there a reason div is used?

patrickhlauke commented 5 years ago

as the tablist/ tab roles override any "listiness" of a <ul>, there's really no practical point for using a list (unless you want to start with a list and then progressively enhance by programmatically adding roles etc)

lkmorlan commented 5 years ago

Yes, it does seem like it is better progressive enhancement to use a ul.

patrickhlauke commented 5 years ago

if you don't programmatically add the role attributes, but they're already in the markup, it won't do any good...

lkmorlan commented 5 years ago

If a user agent doesn't understand ARIA, they are getting better semantics with ul.

ZoeBijl commented 5 years ago

I would argue that a user would be better off with sections with headings in most cases. Given their structure, sections and headings are also easier to progressively turn into tabs (if you work with static HTML that is).

I have some plans to rewrite the JS for tabs. Would you be OK with me closing this when the new version lands with progressively enhanced sections & hxs?

mcking65 commented 4 years ago

I changed the issue title to reflect that the question is about the tablist element, not the tabpanel element.

As @patrickhlauke pointed out, since the role is included in the static HTML, there is no accessibility difference between using div or ul. I would be surprised if you could find a popular user agent that does not correctly map the tablist role.

We could close this as "won't fix" or keep it open as a potential "enhancement" if there is agreement that there is benefit to making this change. I am tempted to close given the enormity of our backlog and the current stability of the tabs ppattern and examples.