RESOLVED FIXED 254981
AX: Make help-text.html and list-detection2.html async-friendly so they can pass consistently in ITM
https://bugs.webkit.org/show_bug.cgi?id=254981
Summary AX: Make help-text.html and list-detection2.html async-friendly so they can p...
Tyler Wilcock
Reported 2023-04-04 01:14:56 PDT
Both of these tests dynamically assign an id to elements via JS without waiting for accessibility to update.
Attachments
Patch (17.27 KB, patch)
2023-04-04 01:19 PDT, Tyler Wilcock
no flags
Patch (18.77 KB, patch)
2023-04-04 10:23 PDT, Tyler Wilcock
no flags
Patch (18.70 KB, patch)
2023-04-04 10:28 PDT, Tyler Wilcock
no flags
Radar WebKit Bug Importer
Comment 1 2023-04-04 01:15:07 PDT
Tyler Wilcock
Comment 2 2023-04-04 01:19:18 PDT
Andres Gonzalez
Comment 3 2023-04-04 06:31:48 PDT
(In reply to Tyler Wilcock from comment #2) > Created attachment 465760 [details] > Patch --- a/LayoutTests/accessibility/help-text.html +++ b/LayoutTests/accessibility/help-text.html + for (var i = 0, c = examples.length; i < c; i++) { examples.forEach would be more concise and elegant here. + var expectation = el.getAttribute("data-expected"); + var description = platformValueForW3CDescription(ax); + if (expectation === expectation) You probably meant expectation === description. Also I would use output += expect(...) instead of this if statement. --- a/LayoutTests/accessibility/list-detection2.html +++ b/LayoutTests/accessibility/list-detection2.html +<script> +window.jsTestIsAsync = true; +</script> We put this in the script tag of the body, not in the head. Does the test use all that CSS in the header? If not, we should remove it. + var el, contentAttrRoleString, axElement, computedAriaRole, expectedRole, result, note; Don't need to forward declare all these variables, declare them where used. + note = el.getAttribute("data-note") Missing ; + result = el.tagName.toLowerCase() + (contentAttrRoleString ? ("[role=\""+contentAttrRoleString+"\"]") : "") + (note ? note : ""); + result = `${el.tagName.toLowerCase()}${contentAttrRoleString ? `[role="${contentAttrRoleString}"]` : ""}${note ? `${note}` : ""}`; ??? + if ((computedAriaRole == expectedRole)) + output += `PASS: ${result}\n`; + else + output += `FAIL: Got ${result}, expected ${expectedRole}\n`; Use output += expect(). + // Once tests are complete, hide all the example markup. + examples = document.querySelectorAll(".ex, #examples"); + for (var i = 0, c = examples.length; i < c; i++) + examples[i].style.display = "none"; Can we just hide examples without having to iterate?
Tyler Wilcock
Comment 4 2023-04-04 10:23:59 PDT
Tyler Wilcock
Comment 5 2023-04-04 10:28:43 PDT
Tyler Wilcock
Comment 6 2023-04-04 10:30:14 PDT
> Also I would use output += expect(...) instead of this if statement. I decided to leave these as-is because the output is nicer than if we used `expect`. > Does the test use all that CSS in the header? If not, we should remove it. Most of the CSS is necessary because CSS influences whether accessibility considers elements to be lists. I did remove some CSS that was unnecessary for the test, though.
Andres Gonzalez
Comment 7 2023-04-04 13:24:19 PDT
(In reply to Tyler Wilcock from comment #6) > > Also I would use output += expect(...) instead of this if statement. > I decided to leave these as-is because the output is nicer than if we used > `expect`. Test code as clean as possible saves time and effort, but not a big deal in this case. In my view, the output is much less important as long as text differences catch errors. > > > Does the test use all that CSS in the header? If not, we should remove it. > Most of the CSS is necessary because CSS influences whether accessibility > considers elements to be lists. I did remove some CSS that was unnecessary > for the test, though.
EWS
Comment 8 2023-04-04 17:08:48 PDT
Committed 262601@main (2701cc7bd554): <https://commits.webkit.org/262601@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 465765 [details].
Note You need to log in before you can comment on or make changes to this bug.