wpt icon indicating copy to clipboard operation
wpt copied to clipboard

Add tests for accnames from hidden labels, captions, and legends

Open adampage opened this issue 1 year ago • 3 comments

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.

adampage avatar Mar 07 '24 01:03 adampage

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">

scottaohara avatar Mar 29 '24 15:03 scottaohara

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:

Anyhow, I’ll pause here. The test results are interesting. Please let me know what you think, @scottaohara / @cookiecrook.

adampage avatar Apr 18 '24 06:04 adampage

Alrightey, @cookiecrook and @scottaohara, I just committed a monster of an update. 😬

This change:

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:

  1. Proposing updates to the HTML-AAM spec itself
  2. Updating/removing specific test expectations
  3. 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

adampage avatar May 29 '24 01:05 adampage