Bug 167898 - [iOS] -[WKWebView becomeFirstResponder] and -[WKWebView resignFirstResponder] don’t get called when non-programmatic first responder changes happen
Summary: [iOS] -[WKWebView becomeFirstResponder] and -[WKWebView resignFirstResponder]...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: mitz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-06 12:05 PST by mitz
Modified: 2017-02-06 20:25 PST (History)
1 user (show)

See Also:


Attachments
Make WKContentView’s -becomeFirstResponder and -resignFirstResponder forward to the WKWebView (7.12 KB, patch)
2017-02-06 18:04 PST, mitz
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2017-02-06 12:05:55 PST
Because the child WKContentView can and does become first responder, WKWebView’s -becomeFirstResponder never gets called by UIKit. Similarly, because the WKWebView is never the first responder, its -resignFirstResponder is never called.

This means that overrides of these methods in a WKWebView subclass normally don’t get called.
Comment 1 mitz 2017-02-06 18:04:01 PST
Created attachment 300776 [details]
Make WKContentView’s -becomeFirstResponder and -resignFirstResponder forward to the WKWebView
Comment 2 Tim Horton 2017-02-06 18:07:37 PST
Comment on attachment 300776 [details]
Make WKContentView’s -becomeFirstResponder and -resignFirstResponder forward to the WKWebView

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

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:1017
> +    if (currentContentView == _contentView && [_contentView superview])

usesStandardContentView?

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:854
> +    _becomingFirstResponder = YES;

ScopedChange? or whatever we called it?
Comment 3 mitz 2017-02-06 20:25:38 PST
Fixed in <https://trac.webkit.org/r211770>.