Add tests for accnames from hidden labels, captions, and legends
Accname tests to support w3c/html-aam#533’s clarification that hidden labels, captions, and legends will not provide an accname to their naturally associated elements unless they are explicitly referenced using aria-labelledby.
would this PR be the place to also create the tests for how browsers should use other naming mechanisms if these elements are hidden?
e.g.,
<label for=d hidden>
this should not be used, cause it'll return the empty string
</label>
<input id=d title="this should be used">
would this PR be the place to also create the tests for how browsers should use other naming mechanisms if these elements are hidden?
So... I took ☝🏻 this ball and ran with it... maybe in the wrong direction. 😵💫
I focused on HTML-AAM’s “4.1 Accname computation by element” section and wrote/copypasta’d a boatload of new tests for each specific element identified there.
Every test specimen follows the same pattern: I simultaneously throw all possible accname techniques at the element, then I assert which one should win based on the conditionals described in the spec. Next, I eliminate 1 technique at a time for subsequent test specimens, rinse and repeat until the element has no remaining accname candidates.
I took a few notes along the way for a few tweaks I might propose in the HTML-AAM spec. I also left 2 sections incomplete:
- 4.1.7 Other form elements — I just did
input type="radio",input type="checkbox", andselectas a start. - 4.1.16 Section and grouping elements — I just did
section,article, andnavas a start.
Anyhow, I’ll pause here. The test results are interesting. Please let me know what you think, @scottaohara / @cookiecrook.
Alrightey, @cookiecrook and @scottaohara, I just committed a monster of an update. 😬
This change:
- Removes the brittle numbered directory names corresponding to the HTML-AAM computation sections.
- Replaces the static subtests with dynamic markup generation.
Now that the subtests are being built dynamically, I was able to quickly introduce a bunch more name-supporting HTML elements that I‘d neglected in my previous push (e.g., <thead>, <progress>, <hr> 🤯 , <input type="color">, etc.).
As a result, the number of subtests have almost doubled from 276 to 510.
I also scattered a few TODO notes around, such as this bit about phrasing elements which I think dovetails with ARIA issues you’ve filed recently, @scottaohara / @rahimabdi. Many of these notes will require deeper investigation on my part. I’m hoping most of them will be resolved either by:
- Proposing updates to the HTML-AAM spec itself
- Updating/removing specific test expectations
- Accepting a failed test result and filing browser bugs
There are also a number of tests that are failing because of web driver errors, such as <optgroup>. I’m not sure what do with those, if anything?
At the end of all of this, I’m looking at HTML-AAM’s Accessible Name Computations By HTML Element section and thinking it could be simplified. Most of the computation steps follow a very linear path through a prioritized set of potential naming sources. My gut says we can define a very small number of “rule sets” and then make a table to pair each nameable HTML element with one of those rule sets. cc: @rahimabdi