[iOS] Cannot tab or shift + tab out of address bar on google.com
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 May 2019 16:22:32 +0000 (16:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 May 2019 16:22:32 +0000 (16:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197859
<rdar://problem/46651565>

Patch by Daniel Bates <dabates@apple.com> on 2019-05-14
Reviewed by Darin Adler.

Non-editable elements can participate in tab cycling via the HTML tabindex attribute.
We should allow setting the initial focus to such an element when transitioning from
the chrome (e.g. address bar) to the web page.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245283 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

index 87b7fe4..17879c4 100644 (file)
@@ -1,3 +1,18 @@
+2019-05-14  Daniel Bates  <dabates@apple.com>
+
+        [iOS] Cannot tab or shift + tab out of address bar on google.com
+        https://bugs.webkit.org/show_bug.cgi?id=197859
+        <rdar://problem/46651565>
+
+        Reviewed by Darin Adler.
+
+        Non-editable elements can participate in tab cycling via the HTML tabindex attribute.
+        We should allow setting the initial focus to such an element when transitioning from
+        the chrome (e.g. address bar) to the web page.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
+
 2019-05-14  Alex Christensen  <achristensen@webkit.org>
 
         Add a unit test for client certificate authentication
index 5c6653a..b8aa435 100644 (file)
@@ -3794,12 +3794,9 @@ static void selectionChangedWithTouch(WKContentView *view, const WebCore::IntPoi
 
 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler
 {
-    auto completionHandlerCopy = Block_copy(completionHandler);
-    RetainPtr<WKContentView> view = self;
-    _page->setInitialFocus(selectingForward, false, WebKit::WebKeyboardEvent(), [view, completionHandlerCopy](WebKit::CallbackBase::Error) {
-        BOOL didBecomeFirstResponder = view->_focusedElementInformation.elementType != WebKit::InputType::None && [view becomeFirstResponder];
-        completionHandlerCopy(didBecomeFirstResponder);
-        Block_release(completionHandlerCopy);
+    constexpr bool isKeyboardEventValid = false;
+    _page->setInitialFocus(selectingForward, isKeyboardEventValid, { }, [protectedSelf = retainPtr(self), completionHandler = makeBlockPtr(completionHandler)] (auto) {
+        completionHandler([protectedSelf becomeFirstResponder]);
     });
 }