Title: [262993] trunk
Revision
262993
Author
wenson_hs...@apple.com
Date
2020-06-12 19:01:44 -0700 (Fri, 12 Jun 2020)

Log Message

[iPadOS] Focusing selects and color inputs should not bring up the software keyboard
https://bugs.webkit.org/show_bug.cgi?id=213149
<rdar://problem/64312450>

Reviewed by Darin Adler.

Source/WebKit:

After <trac.webkit.org/r261658>, we now opt into bringing up the software keyboard when focusing color inputs
and select elements. This is due to the changes in `-_shouldShowAutomaticKeyboardUIIgnoringInputMode`, which
were intended to make us return `NO` for date and time inputs, but also unintentionally makes us return `YES`
on iPadOS.

This patch fixes the bug by returning `!WebKit::currentUserInterfaceIdiomIsPad()` instead, and additionally
preserves the existing behavior of now showing a color picker for `<input type="color" readonly>` on iPhone.

Test: fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView becomeFirstResponderForWebView]):
(-[WKContentView resignFirstResponderForWebView]):
(-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):

LayoutTests:

Add a new layout test.

* fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard-expected.txt: Added.
* fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262992 => 262993)


--- trunk/LayoutTests/ChangeLog	2020-06-13 01:15:20 UTC (rev 262992)
+++ trunk/LayoutTests/ChangeLog	2020-06-13 02:01:44 UTC (rev 262993)
@@ -1,3 +1,16 @@
+2020-06-12  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [iPadOS] Focusing selects and color inputs should not bring up the software keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=213149
+        <rdar://problem/64312450>
+
+        Reviewed by Darin Adler.
+
+        Add a new layout test.
+
+        * fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard-expected.txt: Added.
+        * fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html: Added.
+
 2020-06-12  Andres Gonzalez  <andresg...@apple.com>
 
         Re-write accessibility/form-control-value-settable.html so that it can pass in both isolated tree mode on and off.

Added: trunk/LayoutTests/fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard-expected.txt (0 => 262993)


--- trunk/LayoutTests/fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard-expected.txt	2020-06-13 02:01:44 UTC (rev 262993)
@@ -0,0 +1,11 @@
+This test verifies that tapping a select element on iPad does not bring up the software keyboard.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS isShowingKeyboardAfterFocusingSelect is false
+PASS isShowingKeyboardAfterFocusingColorInput is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  

Added: trunk/LayoutTests/fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html (0 => 262993)


--- trunk/LayoutTests/fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html	2020-06-13 02:01:44 UTC (rev 262993)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<head>
+    <script src=""
+    <script src=""
+    <script>
+        jsTestIsAsync = true;
+
+        addEventListener("load", async () => {
+            description("This test verifies that tapping a select element on iPad does not bring up the software keyboard.");
+
+            if (!window.testRunner)
+                return;
+
+            await UIHelper.setHardwareKeyboardAttached(false);
+
+            const select = document.querySelector("select");
+            await UIHelper.activateElementAndWaitForInputSession(select);
+            isShowingKeyboardAfterFocusingSelect = await UIHelper.isShowingKeyboard();
+            select.blur();
+
+            const colorInput = document.querySelector("input");
+            await UIHelper.activateElementAndWaitForInputSession(colorInput);
+            isShowingKeyboardAfterFocusingColorInput = await UIHelper.isShowingKeyboard();
+            colorInput.blur();
+
+            shouldBeFalse("isShowingKeyboardAfterFocusingSelect");
+            shouldBeFalse("isShowingKeyboardAfterFocusingColorInput");
+            finishJSTest();
+        });
+    </script>
+</head>
+<body>
+    <select>
+        <option selected>Foo</option>
+        <option>Bar</option>
+        <option>Baz</option>
+    </select>
+    <input type="color"></input>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebKit/ChangeLog (262992 => 262993)


--- trunk/Source/WebKit/ChangeLog	2020-06-13 01:15:20 UTC (rev 262992)
+++ trunk/Source/WebKit/ChangeLog	2020-06-13 02:01:44 UTC (rev 262993)
@@ -1,3 +1,27 @@
+2020-06-12  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [iPadOS] Focusing selects and color inputs should not bring up the software keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=213149
+        <rdar://problem/64312450>
+
+        Reviewed by Darin Adler.
+
+        After <trac.webkit.org/r261658>, we now opt into bringing up the software keyboard when focusing color inputs
+        and select elements. This is due to the changes in `-_shouldShowAutomaticKeyboardUIIgnoringInputMode`, which
+        were intended to make us return `NO` for date and time inputs, but also unintentionally makes us return `YES`
+        on iPadOS.
+
+        This patch fixes the bug by returning `!WebKit::currentUserInterfaceIdiomIsPad()` instead, and additionally
+        preserves the existing behavior of now showing a color picker for `<input type="color" readonly>` on iPhone.
+
+        Test: fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView becomeFirstResponderForWebView]):
+        (-[WKContentView resignFirstResponderForWebView]):
+        (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
+        (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
+
 2020-06-12  Alex Christensen  <achristen...@webkit.org>
 
         Make API tests tolerant of our relatively new use of WebPageProxy::preconnectTo

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (262992 => 262993)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-06-13 01:15:20 UTC (rev 262992)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-06-13 02:01:44 UTC (rev 262993)
@@ -1916,6 +1916,9 @@
 
 - (BOOL)_shouldShowAutomaticKeyboardUIIgnoringInputMode
 {
+    if (_focusedElementInformation.isReadOnly)
+        return NO;
+
     switch (_focusedElementInformation.elementType) {
     case WebKit::InputType::None:
     case WebKit::InputType::Drawing:
@@ -1928,8 +1931,9 @@
 #if ENABLE(INPUT_TYPE_COLOR)
     case WebKit::InputType::Color:
 #endif
+        return !WebKit::currentUserInterfaceIdiomIsPad();
     default:
-        return !_focusedElementInformation.isReadOnly;
+        return YES;
     }
     return NO;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to