Bug 161448 - AX: Cannot tab out of WKWebView for macOS
Summary: AX: Cannot tab out of WKWebView for macOS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac All
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-08-31 11:56 PDT by Dan Saunders
Modified: 2019-01-15 14:53 PST (History)
12 users (show)

See Also:


Attachments
Patch (35.05 KB, patch)
2019-01-14 23:51 PST, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (35.41 KB, patch)
2019-01-15 11:02 PST, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (35.41 KB, patch)
2019-01-15 13:03 PST, Tim Horton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Saunders 2016-08-31 11:56:24 PDT
When WKWebView control exists in a window with other controls that accept keyboard focus on macOS, there is no way to tab out of the WKWebView and access the other controls with keyboard. The keyView loop contains a cycle inside the WKWebView regardless of the page being loaded. This could block using WKWebView in accessible applications, without voiceover there is no way to exit the control using keyboard. WebView control does not have this issue.
Comment 1 Radar WebKit Bug Importer 2016-08-31 11:57:02 PDT
<rdar://problem/28100085>
Comment 2 Dan Saunders 2016-09-12 17:39:20 PDT
UIDelegate::UIClient::takeFocus needs to be implemented to get this behavior
Comment 3 Tim Horton 2019-01-14 23:51:29 PST
Created attachment 359141 [details]
Patch
Comment 4 Wenson Hsieh 2019-01-15 07:26:31 PST
Comment on attachment 359141 [details]
Patch

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

> Tools/TestWebKitAPI/Tests/WebKitCocoa/CommandBackForward.mm:86
> +        window = [[OffscreenWindow alloc] initWithSize:CGSizeMake(100, 100)];

adopt?

> Tools/TestWebKitAPI/Tests/WebKitCocoa/TabOutOfWebView.mm:61
> +    RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 100, 100, 100) configuration:[[WKWebViewConfiguration alloc] init] addToWindow:NO]);

Let's -autorelease the configuration, or put it in a RetainPtr and use adoptNS.
Comment 5 Tim Horton 2019-01-15 10:43:15 PST
(In reply to Wenson Hsieh from comment #4)
> Comment on attachment 359141 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=359141&action=review
> 
> > Tools/TestWebKitAPI/Tests/WebKitCocoa/CommandBackForward.mm:86
> > +        window = [[OffscreenWindow alloc] initWithSize:CGSizeMake(100, 100)];
> 
> adopt?
> 
> > Tools/TestWebKitAPI/Tests/WebKitCocoa/TabOutOfWebView.mm:61
> > +    RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 100, 100, 100) configuration:[[WKWebViewConfiguration alloc] init] addToWindow:NO]);
> 
> Let's -autorelease the configuration, or put it in a RetainPtr and use
> adoptNS.

LOL I've been ARCing too much. Thank you for your eyes.
Comment 6 Tim Horton 2019-01-15 11:02:25 PST
Created attachment 359181 [details]
Patch
Comment 7 Tim Horton 2019-01-15 13:03:58 PST
Created attachment 359193 [details]
Patch
Comment 8 WebKit Commit Bot 2019-01-15 14:53:45 PST
Comment on attachment 359193 [details]
Patch

Clearing flags on attachment: 359193

Committed r240010: <https://trac.webkit.org/changeset/240010>
Comment 9 WebKit Commit Bot 2019-01-15 14:53:46 PST
All reviewed patches have been landed.  Closing bug.