Bug 232033 - AX: Remove redundant insert of autofill button child in AccessibilityRenderObject::addTextFieldChildren
Summary: AX: Remove redundant insert of autofill button child in AccessibilityRenderOb...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-20 12:34 PDT by Tyler Wilcock
Modified: 2021-10-21 09:49 PDT (History)
11 users (show)

See Also:


Attachments
Patch (7.94 KB, patch)
2021-10-20 12:49 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (9.14 KB, patch)
2021-10-20 14:12 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (7.79 KB, patch)
2021-10-20 14:21 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 2021-10-20 12:34:30 PDT
This child is represented in the DOM, so there's no reason to also insert it in AccessibilityRenderObject::addTextFieldChildren. This results in duplicate objects for this button in the AX tree. When the autofill button is created, it results in this markup:

<div pseudo="-webkit-textfield-decoration-container">
   <div>
      <div contenteditable="plaintext-only">hello</div>
   </div>
   <div pseudo="-webkit-contacts-auto-fill-button" role="button" aria-label="contact info AutoFill" style="display: block !important;"></div>
</div>

Given this:

```
<input type="text" value="hello" id="textfield">
window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Contacts");
```

Then accessibilityController.accessibleElementById('textfield').childrenCount should be 2 (on non-glib platforms). But it is three. And if we look at what those three are, the first two are expected, and the last is a redundant button object:

Child 0:
AXRole: AXGroup
AXRoleDescription: group
AXSize: NSSize: {114, 13}
AXDescription:


Child 1:
AXRole: AXButton
AXRoleDescription: button
AXSize: NSSize: {23, 13}
AXDescription: contact info AutoFill


Child 2:
AXRole: AXButton
AXRoleDescription: button
AXSize: NSSize: {23, 13}
AXDescription: contact info AutoFill
Comment 1 Radar WebKit Bug Importer 2021-10-20 12:34:45 PDT
<rdar://problem/84474441>
Comment 2 Tyler Wilcock 2021-10-20 12:49:21 PDT
Created attachment 441921 [details]
Patch
Comment 3 Tyler Wilcock 2021-10-20 12:53:00 PDT
cc cgarcia@igalia.com because I'm modifying some glib expectations and they've been doing GTK AX work recently.
Comment 4 chris fleizach 2021-10-20 13:39:34 PDT
Comment on attachment 441921 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=441921&action=review

> Source/WebCore/ChangeLog:34
> +        Child 0:

this might be a little too in depth for change log. can you summarize these changes a little more succinctly
Comment 5 Andres Gonzalez 2021-10-20 13:53:35 PDT
(In reply to Tyler Wilcock from comment #2)
> Created attachment 441921 [details]
> Patch

--- a/LayoutTests/accessibility/auto-fill-crash.html
+++ a/LayoutTests/accessibility/auto-fill-crash.html

-        var childrenCountExpected = accessibilityController.platformName == "atk" ? "2" : "3";
+        var childrenCountExpected = accessibilityController.platformName == "atk" ? "1" : "2";

Isn't ATK doing it wright and getting 2 children here?
Comment 6 Tyler Wilcock 2021-10-20 14:12:43 PDT
Created attachment 441932 [details]
Patch
Comment 7 Tyler Wilcock 2021-10-20 14:21:56 PDT
Created attachment 441935 [details]
Patch
Comment 8 Tyler Wilcock 2021-10-20 14:26:23 PDT
> this might be a little too in depth for change log. can you summarize these changes a little more succinctly
Done.

>Isn't ATK doing it wright and getting 2 children here?
I would think ATK would expect one less too since we're inserting one less thing into the tree.
Comment 9 EWS 2021-10-21 09:49:49 PDT
Committed r284612 (243339@main): <https://commits.webkit.org/243339@main>

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