web-platform-tests / interop-accessibility

Accessibility Testing for WPT
https://wpt.fyi/results/?q=label%3Aaccessibility
38 stars 5 forks source link

add error handling for missing attrs in aria-utils.js #74

Open cookiecrook opened 10 months ago

cookiecrook commented 10 months ago

A colleague mentioned they'd put data-expectedname in the markup instead of data-expectedlabel, but verifyLabelsbySelectors() didn't give a clear error that the attr was actually missing. Presumably it just called el.getAttribute('data-expectedlabel') and got back an empty string for the comparison.

We can probably fix that and similar issues by throwing more errors or warnings in several places.

rahimabdi commented 10 months ago

Agreed! I was also curious why we weren't using "name" across the board (as opposed to data-expectedlabel, verifyLabelsBySelector()) but I see you touched on the rationale here: https://github.com/web-platform-tests/interop-accessibility/issues/65#issuecomment-1803261059.

cookiecrook commented 10 months ago

For completeness, "name" is common in Windows Accessibility APIs, but not Mac/iOS. There are concepts of accessible labels on all platforms, but IIRC only Window makes the distinction between the terms assuming label has to be rendered text or something similar that is used for the name. Early on, MacOS used AXTitle/AXDescription similarly to how Windows used label/name. I got involved in ARIA in 2006 or so, in part to fix many overlooked things related to Apple platforms; including the Windows-centric keyboard shortcuts, and several misunderstandings of how aria-describedby should be mapped (It's not the same concept as AXDescription)…

Since there were already a number of unrelated-to-accessibility uses of "name" in the Web Platform, the ARIA WG went with aria-label/aria-labelledby (British spelling of "labelled" for some reason).

"computed label" follows that pattern... I recall the reason AccName uses "name" is mainly editorial—as in, the primary editor at the time came from the Windows side and liked "name" better. There were a number of Windows-style artifacts in the original ARIA spec. Many still exist in some form.

cookiecrook commented 1 month ago

@janewman interested in this issue. Will work with @benbeaudry or @chrishtr to get into the Interop GH team.