Bug 245212 - AX: Dynamic changes to subtrees of AccessibilityNodeObjects can cause missing or stale content
Summary: AX: Dynamic changes to subtrees of AccessibilityNodeObjects can cause missing...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-09-15 00:35 PDT by Tyler Wilcock
Modified: 2022-09-15 15:39 PDT (History)
10 users (show)

See Also:


Attachments
Patch (13.51 KB, patch)
2022-09-15 00:38 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler Wilcock 2022-09-15 00:35:54 PDT
AccessibilityNodeObject is missing a few key method implementations that can cause incorrect AX tree construction (either missing or stale content) after dynamic page updates. These methods are:
  - updateChildrenIfNecessary
  - setNeedsToUpdateChildren
  - needsToUpdateChildren
  - setNeedsToUpdateSubtree
Comment 1 Radar WebKit Bug Importer 2022-09-15 00:36:05 PDT
<rdar://problem/99956378>
Comment 2 Tyler Wilcock 2022-09-15 00:38:56 PDT
Created attachment 462352 [details]
Patch
Comment 3 Andres Gonzalez 2022-09-15 06:58:07 PDT
(In reply to Tyler Wilcock from comment #2)
> Created attachment 462352 [details]
> Patch

Good catch!

--- a/LayoutTests/accessibility/display-contents-dynamically-added-children.html
+++ a/LayoutTests/accessibility/display-contents-dynamically-added-children.html

+    function traversePage() {
...
+                let textContent = accessibilityController.platformName === "ios" ? searchResult.description : searchResult.stringValue;
+                testOutput += `\n${textContent}`;

This could be a single line.

+            }
+            testOutput += "\n";
+        }
+    }

Don't really need this second \n.

You also have 

function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttributesIfNeeded, getValueFromTitle, includeSubrole) 

in accessibility-helper.js that would also do the trick.
Comment 4 Andres Gonzalez 2022-09-15 07:02:39 PDT
Shouldn't the bug title reflect that this is a display:contents problem?
Comment 5 Tyler Wilcock 2022-09-15 14:59:44 PDT
(In reply to Andres Gonzalez from comment #4)
> Shouldn't the bug title reflect that this is a display:contents problem?
This isn't specific to display:contents. Any AccessibilityNodeObject is affected.

Also, I acknowledge and agree with your suggestions regarding the test. I would prefer not to wait 12 hours for another round of EWS, so I can try to cover those changes in a later patch.
Comment 6 EWS 2022-09-15 15:39:32 PDT
Committed 254534@main (c6e7fc8ecc94): <https://commits.webkit.org/254534@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 462352 [details].