Bug 260191

Summary: AX: NSApplicationAccessibilityFocusedUIElement is sometimes an ignored object which breaks functionality for Voice Control in Mail
Product: WebKit Reporter: Tyler Wilcock <tyler_w>
Component: AccessibilityAssignee: Tyler Wilcock <tyler_w>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cfleizach, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Tyler Wilcock 2023-08-14 21:24:58 PDT
...
Comment 1 Radar WebKit Bug Importer 2023-08-14 21:25:05 PDT
<rdar://problem/113888778>
Comment 2 Tyler Wilcock 2023-08-14 21:26:53 PDT
rdar://113689647
Comment 3 Tyler Wilcock 2023-08-14 21:36:46 PDT
Created attachment 467277 [details]
Patch
Comment 4 Andres Gonzalez 2023-08-15 07:44:38 PDT
(In reply to Tyler Wilcock from comment #3)
> Created attachment 467277 [details]
> Patch

diff --git a/LayoutTests/accessibility/editable-webpage-focused-ui-element.html b/LayoutTests/accessibility/editable-webpage-focused-ui-element.html
new file mode 100644
index 000000000000..893a3aad6d79
--- /dev/null
+++ b/LayoutTests/accessibility/editable-webpage-focused-ui-element.html

+    output += evalAndReturn("internals.setSelectionFromNone();");

Do we need evalAndReturn or you could just call internals.setSelectionFromNone?

+        // Wait for focus to sync to the <body> and update the AX tree as a result of setSelectionFromNone().
+        await sleep(100);

Can we make this deterministic with a waitFor? Waiting for hard-coded intervals often leads to flaky behaviors.
Comment 5 Tyler Wilcock 2023-08-15 10:01:41 PDT
(In reply to Andres Gonzalez from comment #4)
> (In reply to Tyler Wilcock from comment #3)
> > Created attachment 467277 [details]
> > Patch
> 
> diff --git
> a/LayoutTests/accessibility/editable-webpage-focused-ui-element.html
> b/LayoutTests/accessibility/editable-webpage-focused-ui-element.html
> new file mode 100644
> index 000000000000..893a3aad6d79
> --- /dev/null
> +++ b/LayoutTests/accessibility/editable-webpage-focused-ui-element.html
> 
> +    output += evalAndReturn("internals.setSelectionFromNone();");
> 
> Do we need evalAndReturn or you could just call
> internals.setSelectionFromNone?
> 
> +        // Wait for focus to sync to the <body> and update the AX tree as a
> result of setSelectionFromNone().
> +        await sleep(100);
> 
> Can we make this deterministic with a waitFor? Waiting for hard-coded
> intervals often leads to flaky behaviors.
Will address these in a follow-up, thanks.
Comment 6 EWS 2023-08-15 10:37:46 PDT
Committed 266917@main (30959c84f8ab): <https://commits.webkit.org/266917@main>

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