w3c / html-aam

HTML Accessibility API Mappings - new spec updates should be made in https://github.com/w3c/aria/tree/main/html-aam
https://w3c.github.io/html-aam/
Other
102 stars 27 forks source link

Table without table headers #562

Open giacomo-petri opened 2 months ago

giacomo-petri commented 2 months ago

The implicit role of <table> elements is always role="table".

However, when a table lacks headers, browsers handle it inconsistently:

This inconsistency can create challenges for implementors implementing rules like ARIA in HTML, as it affects how table rules and related rules for descendant elements are applied.

It may be beneficial to clearly specify in the standards how user agents should handle tables without headers to ensure consistency.

spectranaut commented 2 months ago

Discussed for a bit in triage at today's meeting: https://www.w3.org/2024/09/05-aria-minutes#t01

aleventhal commented 2 months ago

WebKit's IsDataTable impl: https://github.com/WebKit/WebKit/blob/main/Source/WebCore/accessibility/AccessibilityTable.cpp#L130

Blink's IsDataTable() impl: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/accessibility/ax_node_object.cc;l=1600

aleventhal commented 2 months ago

TBH anyone can do the work to compile the list of rules in each system for comparison since the code is heavily commented.

fstrr commented 2 months ago

I mentioned this What Even Is A Table presentation, from State Of The Browser 5 conference back in 2015, in this week's call. All the conference videos aren't online anymore, but I luckily took notes before the videos were removed. This was the list of findings, which may not be accurate anymore for the browsers that still exist, but do paint a picture of the complexity of browsers trying to decide whether a table is for layout or data:

fstrr commented 2 months ago

Mmm. Looks like @aleventhal's links are probably more useful, although we're both missing Firefox. I've had a look in the Gecko-Dev repo, but nothing obvious jumped out at me.

jnurthen commented 2 months ago

@fstrr is it this? https://github.com/mozilla/gecko-dev/blob/d0bb241361ffcdab8fa82009c8645e26733bd1ef/accessible/html/HTMLTableAccessible.cpp#L422

aleventhal commented 2 months ago

@fstrr is it this? https://github.com/mozilla/gecko-dev/blob/d0bb241361ffcdab8fa82009c8645e26733bd1ef/accessible/html/HTMLTableAccessible.cpp#L422

That's it.

fstrr commented 2 months ago

@jnurthen yup! Nice :)

scottaohara commented 2 months ago

related - https://github.com/w3c/html-aam/issues/293

kerlysboordank commented 1 month ago

Creating a paragraph without using table headers can be an effective way to present information in a more narrative style. For instance, if you want to convey data about various fruits, you might say:

"Apples are rich in fiber and vitamin C, making them a popular choice for a healthy snack. Bananas, known for their potassium content, provide table tops canada quick energy and are great for athletes. Oranges are celebrated for their high vitamin C levels and refreshing taste, often enjoyed as juice