Bug 243407

Summary: AX: accessibility/add-children-pseudo-element.html is a flakey failure since introduction
Product: WebKit Reporter: Tyler Wilcock <tyler_w>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: andresg_22, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Tyler Wilcock 2022-08-01 09:06:35 PDT
The expected behavior (that an AXImage with "circle" AXStaticText child is added to the AX tree) has been flakey since introduction, and was only exposed by:

https://bugs.webkit.org/show_bug.cgi?id=243373 (AX: An unnecessary group is created for every block-flow box with no other useful AX semantics)

Because it removed an unnecessary group from the AX tree which this test relied on to "pass". However, on today's `main` I can get the behavior to be wrong 50% of the time.

---

<div id="float" style="display: inline-block;" class="pseudo">
    <span required="" style="color: rgb(194, 0, 0);">Email</span>
    <input type="text" required="" aria-required="true" value="" onkeyup="hidePseudo();">
  </div>
</div>

element = accessibilityController.accessibleElementById("float");
if (accessibilityController.platformName != "atspi")
    shouldBe("element.childrenCount", "3");
else
    shouldBe("element.childrenCount", "2");

debug(dumpAccessibilityTree(accessibilityController.accessibleElementById('content'), null, 0)[1]);

--- The two different `main` results you can regularly get:

Result 1

PASS element.childrenCount is 3
AXRole: AXGroup AXValue:
    AXRole: AXGroup AXValue:
        AXRole: AXStaticText AXValue: Language
        AXRole: AXTextField AXValue:
    AXRole: AXGroup AXValue:
        AXRole: AXStaticText AXValue: Email
        AXRole: AXTextField AXValue:
        AXRole: AXGroup AXValue:

Result 2

PASS element.childrenCount is 3
AXRole: AXGroup AXValue:
    AXRole: AXGroup AXValue:
        AXRole: AXStaticText AXValue: Language
        AXRole: AXTextField AXValue:
    AXRole: AXGroup AXValue:
        AXRole: AXStaticText AXValue: Email
        AXRole: AXTextField AXValue:
        AXRole: AXGroup AXValue:
            AXRole: AXImage AXValue:
                AXRole: AXGroup AXValue:
                    AXRole: AXStaticText AXValue: circle


And after https://bugs.webkit.org/show_bug.cgi?id=243373, here are the two results you can get (note the removal of the group exposes the incorrect behavior):

Result 1

FAIL element.childrenCount should be 3. Was 2.
AXRole: AXGroup AXValue:
    AXRole: AXGroup AXValue:
        AXRole: AXStaticText AXValue: Language
        AXRole: AXTextField AXValue:
    AXRole: AXGroup AXValue:
        AXRole: AXStaticText AXValue: Email
        AXRole: AXTextField AXValue:


Result 2

PASS element.childrenCount is 3
AXRole: AXGroup AXValue:
    AXRole: AXGroup AXValue:
        AXRole: AXStaticText AXValue: Language
        AXRole: AXTextField AXValue:
    AXRole: AXGroup AXValue:
        AXRole: AXStaticText AXValue: Email
        AXRole: AXTextField AXValue:
        AXRole: AXImage AXValue:
            AXRole: AXGroup AXValue:
                AXRole: AXStaticText AXValue: circle
Comment 1 Radar WebKit Bug Importer 2022-08-01 09:06:48 PDT
<rdar://problem/97917082>