Diff
Modified: branches/safari-611-branch/LayoutTests/ChangeLog (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/ChangeLog 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/ChangeLog 2021-02-17 01:17:09 UTC (rev 272952)
@@ -1,5 +1,105 @@
2021-02-16 Ruben Turcios <rubent...@apple.com>
+ Cherry-pick r272495. rdar://problem/74409320
+
+ [macOS] Return key binding for date inputs conflicts with return to submit form
+ https://bugs.webkit.org/show_bug.cgi?id=221532
+ <rdar://problem/74039204>
+
+ Reviewed by Wenson Hsieh.
+
+ Source/WebCore:
+
+ Currently, pressing the return key within a focused date input presents
+ the calendar view, rather than submitting an associated form. This is a
+ usability issue for keyboard users, and is different from the behavior
+ in Chrome. This patch matches the behavior in Chrome, and makes it so
+ that a return keypress submits an associated form.
+
+ However, since the return key is now reserved for form submission, we
+ need a new key to present the calendar view for the date input. Chrome
+ and Firefox use the space key for this functionality, so this patch
+ matches that behavior.
+
+ Note that r267281 updated date inputs to focus the next editable component
+ when pressing the space key. This behavior is now removed in favor of
+ presenting the calendar. Other separator keys, and arrow keys, can still be
+ used to focus the next editable component.
+
+ Tests: fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html
+ fast/forms/date/date-editable-components/form-submit-on-return-keypress.html
+
+ * html/BaseDateAndTimeInputType.cpp:
+ (WebCore::BaseDateAndTimeInputType::handleKeypressEvent):
+
+ Date and time inputs are BaseClickableWithKeyInputTypes. This gives them
+ activation behavior on return and space keypresses, similar to button and
+ color inputs. However, since date/time inputs are closer to textfields,
+ than buttons, we elide activation behavior on a return keypress, allowing
+ the event to submit an associated form. Activation behavior on a space
+ keypress is supported by going through the existing code path.
+
+ * html/shadow/DateTimeFieldElement.cpp:
+ (WebCore::DateTimeFieldElement::defaultKeyboardEventHandler):
+
+ Remove "Space" from the list of separator keys that focus the next
+ editable component.
+
+ LayoutTests:
+
+ Added tests to verify that pressing the space key in a focused date
+ input presents a calendar view, and pressing the enter key in a focused
+ date input submits a form.
+
+ Rebaselined existing tests to account for the fact that the space key
+ no longer focuses the next editable component within a date input.
+
+ * fast/forms/date/date-editable-components/date-editable-components-keyboard-events-expected.txt:
+ * fast/forms/date/date-editable-components/date-editable-components-keyboard-events.html:
+ * fast/forms/date/date-editable-components/date-picker-show-on-space-keypress-expected.txt: Added.
+ * fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html: Added.
+ * fast/forms/date/date-editable-components/form-submit-on-return-keypress-expected.txt: Added.
+ * fast/forms/date/date-editable-components/form-submit-on-return-keypress.html: Added.
+ * fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events-expected.txt:
+ * fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events.html:
+ * fast/forms/month/month-editable-components/month-editable-components-keyboard-events-expected.txt:
+ * fast/forms/month/month-editable-components/month-editable-components-keyboard-events.html:
+ * fast/forms/time/time-editable-components/time-editable-components-keyboard-events-expected.txt:
+ * fast/forms/time/time-editable-components/time-editable-components-keyboard-events.html:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-02-08 Aditya Keerthi <akeer...@apple.com>
+
+ [macOS] Return key binding for date inputs conflicts with return to submit form
+ https://bugs.webkit.org/show_bug.cgi?id=221532
+ <rdar://problem/74039204>
+
+ Reviewed by Wenson Hsieh.
+
+ Added tests to verify that pressing the space key in a focused date
+ input presents a calendar view, and pressing the enter key in a focused
+ date input submits a form.
+
+ Rebaselined existing tests to account for the fact that the space key
+ no longer focuses the next editable component within a date input.
+
+ * fast/forms/date/date-editable-components/date-editable-components-keyboard-events-expected.txt:
+ * fast/forms/date/date-editable-components/date-editable-components-keyboard-events.html:
+ * fast/forms/date/date-editable-components/date-picker-show-on-space-keypress-expected.txt: Added.
+ * fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html: Added.
+ * fast/forms/date/date-editable-components/form-submit-on-return-keypress-expected.txt: Added.
+ * fast/forms/date/date-editable-components/form-submit-on-return-keypress.html: Added.
+ * fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events-expected.txt:
+ * fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events.html:
+ * fast/forms/month/month-editable-components/month-editable-components-keyboard-events-expected.txt:
+ * fast/forms/month/month-editable-components/month-editable-components-keyboard-events.html:
+ * fast/forms/time/time-editable-components/time-editable-components-keyboard-events-expected.txt:
+ * fast/forms/time/time-editable-components/time-editable-components-keyboard-events.html:
+
+2021-02-16 Ruben Turcios <rubent...@apple.com>
+
Cherry-pick r272435. rdar://problem/74410448
[LFC][Integration] Hit testing broken for descendants of pointer-events:none boxes
Modified: branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-editable-components-keyboard-events-expected.txt (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-editable-components-keyboard-events-expected.txt 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-editable-components-keyboard-events-expected.txt 2021-02-17 01:17:09 UTC (rev 272952)
@@ -36,7 +36,6 @@
PASS inputEventsFired is 3
Advance field keys
-PASS input.value is "2020-06-02"
PASS input.value is "2020-06-03"
PASS input.value is "2020-06-04"
PASS input.value is "2020-06-05"
@@ -43,8 +42,8 @@
PASS input.value is "2020-06-06"
PASS input.value is "2020-06-07"
PASS input.value is "2020-06-08"
-PASS changeEventsFired is 7
-PASS inputEventsFired is 7
+PASS changeEventsFired is 6
+PASS inputEventsFired is 6
Up/Down arrow keys
PASS input.value is "2020-01-20"
Modified: branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-editable-components-keyboard-events.html (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-editable-components-keyboard-events.html 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-editable-components-keyboard-events.html 2021-02-17 01:17:09 UTC (rev 272952)
@@ -130,12 +130,8 @@
shouldBe("changeEventsFired", "3");
shouldBe("inputEventsFired", "3");
- beginTest("Advance field keys", "2020-06-05"); // [06]/01/2020
- UIHelper.keyDown(" "); // -> 06/[01]/2020
- UIHelper.keyDown("2"); // -> 06/[02]/2020
- shouldBeEqualToString("input.value", "2020-06-02");
- UIHelper.keyDown("leftArrow"); // -> [06]/02/2020
- UIHelper.keyDown("/"); // -> 06/[02]/2020
+ beginTest("Advance field keys", "2020-06-05"); // [06]/05/2020
+ UIHelper.keyDown("/"); // -> 06/[05]/2020
UIHelper.keyDown("3"); // -> 06/[03]/2020
shouldBeEqualToString("input.value", "2020-06-03");
UIHelper.keyDown("leftArrow"); // -> [06]/03/2020
@@ -158,8 +154,8 @@
UIHelper.keyDown(","); // -> 06/[07]/2020
UIHelper.keyDown("8"); // -> 06/[08]/2020
shouldBeEqualToString("input.value", "2020-06-08");
- shouldBe("changeEventsFired", "7");
- shouldBe("inputEventsFired", "7");
+ shouldBe("changeEventsFired", "6");
+ shouldBe("inputEventsFired", "6");
beginTest("Up/Down arrow keys", "2020-12-20"); // [12]/20/2020
UIHelper.keyDown("upArrow"); // [01]/20/2020
Added: branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-picker-show-on-space-keypress-expected.txt (0 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-picker-show-on-space-keypress-expected.txt (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-picker-show-on-space-keypress-expected.txt 2021-02-17 01:17:09 UTC (rev 272952)
@@ -0,0 +1,12 @@
+Tests that a date input's calendar view can be opened using the space key, without any mouse interaction.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS showingPicker is false
+Focusing input using tab key and then pressing space key.
+PASS showingPicker is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html (0 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html 2021-02-17 01:17:09 UTC (rev 272952)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<input id="input" type="date" value="2020-09-16"/>
+
+<script>
+
+jsTestIsAsync = true;
+
+addEventListener("load", async () => {
+ description("Tests that a date input's calendar view can be opened using the space key, without any mouse interaction.");
+
+ showingPicker = await UIHelper.isShowingDateTimePicker();
+ shouldBeFalse("showingPicker");
+
+ debug("Focusing input using tab key and then pressing space key.");
+ UIHelper.keyDown("\t");
+ UIHelper.keyDown(" ");
+ await UIHelper.ensurePresentationUpdate();
+
+ showingPicker = await UIHelper.isShowingDateTimePicker();
+ shouldBeTrue("showingPicker");
+
+ finishJSTest();
+});
+</script>
+
+</body>
+</html>
Added: branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/form-submit-on-return-keypress-expected.txt (0 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/form-submit-on-return-keypress-expected.txt (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/form-submit-on-return-keypress-expected.txt 2021-02-17 01:17:09 UTC (rev 272952)
@@ -0,0 +1,10 @@
+Tests that focusing a date input and pressing the return key submits a form.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Submitted form.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Enter birthday:
Added: branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/form-submit-on-return-keypress.html (0 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/form-submit-on-return-keypress.html (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/forms/date/date-editable-components/form-submit-on-return-keypress.html 2021-02-17 01:17:09 UTC (rev 272952)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<form id="form">
+ Enter birthday: <input id="input" type="date" value="2020-09-16"/>
+ <input type="submit"/>
+</form>
+
+<script>
+
+jsTestIsAsync = true;
+
+addEventListener("load", async () => {
+ description("Tests that focusing a date input and pressing the return key submits a form.");
+
+ form.addEventListener("submit", (event) => {
+ debug("Submitted form.");
+ finishJSTest();
+ });
+
+ UIHelper.keyDown("\t");
+ UIHelper.keyDown("\r");
+});
+
+</script>
+
+</body>
+</html>
Modified: branches/safari-611-branch/LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events-expected.txt (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events-expected.txt 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events-expected.txt 2021-02-17 01:17:09 UTC (rev 272952)
@@ -38,7 +38,6 @@
PASS inputEventsFired is 11
Advance field keys
-PASS input.value is "2020-06-02T16:27"
PASS input.value is "2020-06-03T16:27"
PASS input.value is "2020-06-04T16:27"
PASS input.value is "2020-06-05T16:27"
@@ -45,8 +44,8 @@
PASS input.value is "2020-06-06T16:27"
PASS input.value is "2020-06-07T16:27"
PASS input.value is "2020-06-08T16:27"
-PASS changeEventsFired is 7
-PASS inputEventsFired is 7
+PASS changeEventsFired is 6
+PASS inputEventsFired is 6
Up/Down arrow keys
PASS input.value is "2020-01-20T23:59"
Modified: branches/safari-611-branch/LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events.html (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events.html 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events.html 2021-02-17 01:17:09 UTC (rev 272952)
@@ -141,12 +141,8 @@
shouldBe("changeEventsFired", "11");
shouldBe("inputEventsFired", "11");
- beginTest("Advance field keys", "2020-06-05T16:27"); // [06]/01/2020 04:27 PM
- UIHelper.keyDown(" "); // -> 06/[01]/2020 04:27 PM
- UIHelper.keyDown("2"); // -> 06/[02]/2020 04:27 PM
- shouldBeEqualToString("input.value", "2020-06-02T16:27");
- UIHelper.keyDown("leftArrow"); // -> [06]/02/2020 04:27 PM
- UIHelper.keyDown("/"); // -> 06/[02]/2020 04:27 PM
+ beginTest("Advance field keys", "2020-06-05T16:27"); // [06]/05/2020 04:27 PM
+ UIHelper.keyDown("/"); // -> 06/[05]/2020 04:27 PM
UIHelper.keyDown("3"); // -> 06/[03]/2020 04:27 PM
shouldBeEqualToString("input.value", "2020-06-03T16:27");
UIHelper.keyDown("leftArrow"); // -> [06]/03/2020 04:27 PM
@@ -169,8 +165,8 @@
UIHelper.keyDown(","); // -> 06/[07]/2020 04:27 PM
UIHelper.keyDown("8"); // -> 06/[08]/2020 04:27 PM
shouldBeEqualToString("input.value", "2020-06-08T16:27");
- shouldBe("changeEventsFired", "7");
- shouldBe("inputEventsFired", "7");
+ shouldBe("changeEventsFired", "6");
+ shouldBe("inputEventsFired", "6");
beginTest("Up/Down arrow keys", "2020-12-20T23:59"); // [12]/20/2020 11:59 PM
UIHelper.keyDown("upArrow"); // -> [01]/20/2020 11:59 PM
Modified: branches/safari-611-branch/LayoutTests/fast/forms/month/month-editable-components/month-editable-components-keyboard-events-expected.txt (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/month/month-editable-components/month-editable-components-keyboard-events-expected.txt 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/fast/forms/month/month-editable-components/month-editable-components-keyboard-events-expected.txt 2021-02-17 01:17:09 UTC (rev 272952)
@@ -36,7 +36,6 @@
PASS inputEventsFired is 2
Advance field keys
-PASS input.value is "0002-06"
PASS input.value is "0003-06"
PASS input.value is "0004-06"
PASS input.value is "0005-06"
@@ -43,8 +42,8 @@
PASS input.value is "0006-06"
PASS input.value is "0007-06"
PASS input.value is "0008-06"
-PASS changeEventsFired is 7
-PASS inputEventsFired is 7
+PASS changeEventsFired is 6
+PASS inputEventsFired is 6
Up/Down arrow keys
PASS input.value is "2020-01"
Modified: branches/safari-611-branch/LayoutTests/fast/forms/month/month-editable-components/month-editable-components-keyboard-events.html (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/month/month-editable-components/month-editable-components-keyboard-events.html 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/fast/forms/month/month-editable-components/month-editable-components-keyboard-events.html 2021-02-17 01:17:09 UTC (rev 272952)
@@ -113,11 +113,7 @@
shouldBe("inputEventsFired", "2");
beginTest("Advance field keys", "2020-06"); // [06]/2020
- UIHelper.keyDown(" "); // -> 06/[2020]
- UIHelper.keyDown("2"); // -> 06/[0002]
- shouldBeEqualToString("input.value", "0002-06");
- UIHelper.keyDown("leftArrow"); // -> [06]/0002
- UIHelper.keyDown("/"); // -> 06/[0002]
+ UIHelper.keyDown("/"); // -> 06/[2020]
UIHelper.keyDown("3"); // -> 06/[0003]
shouldBeEqualToString("input.value", "0003-06");
UIHelper.keyDown("leftArrow"); // -> [06]/0003
@@ -140,8 +136,8 @@
UIHelper.keyDown(","); // -> 06/[0007]
UIHelper.keyDown("8"); // -> 06/[0008]
shouldBeEqualToString("input.value", "0008-06");
- shouldBe("changeEventsFired", "7");
- shouldBe("inputEventsFired", "7");
+ shouldBe("changeEventsFired", "6");
+ shouldBe("inputEventsFired", "6");
beginTest("Up/Down arrow keys", "2020-12"); // [12]/2020
UIHelper.keyDown("upArrow"); // [01]/2020
Modified: branches/safari-611-branch/LayoutTests/fast/forms/time/time-editable-components/time-editable-components-keyboard-events-expected.txt (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/time/time-editable-components/time-editable-components-keyboard-events-expected.txt 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/fast/forms/time/time-editable-components/time-editable-components-keyboard-events-expected.txt 2021-02-17 01:17:09 UTC (rev 272952)
@@ -30,7 +30,6 @@
PASS inputEventsFired is 5
Advance field keys
-PASS input.value is "01:02"
PASS input.value is "01:03"
PASS input.value is "01:04"
PASS input.value is "01:05"
@@ -37,8 +36,8 @@
PASS input.value is "01:06"
PASS input.value is "01:07"
PASS input.value is "01:08"
-PASS changeEventsFired is 7
-PASS inputEventsFired is 7
+PASS changeEventsFired is 6
+PASS inputEventsFired is 6
Up/Down arrow keys
PASS input.value is "12:59"
Modified: branches/safari-611-branch/LayoutTests/fast/forms/time/time-editable-components/time-editable-components-keyboard-events.html (272951 => 272952)
--- branches/safari-611-branch/LayoutTests/fast/forms/time/time-editable-components/time-editable-components-keyboard-events.html 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/LayoutTests/fast/forms/time/time-editable-components/time-editable-components-keyboard-events.html 2021-02-17 01:17:09 UTC (rev 272952)
@@ -94,11 +94,7 @@
shouldBe("inputEventsFired", "5");
beginTest("Advance field keys", "01:28"); // [01]:28 AM
- UIHelper.keyDown(" "); // -> 01:[28] AM
- UIHelper.keyDown("2"); // -> 01:[02] AM
- shouldBeEqualToString("input.value", "01:02");
- UIHelper.keyDown("leftArrow"); // -> [01]:02 AM
- UIHelper.keyDown("/"); // -> 01:[02] AM
+ UIHelper.keyDown("/"); // -> 01:[28] AM
UIHelper.keyDown("3"); // -> 01:[03] AM
shouldBeEqualToString("input.value", "01:03");
UIHelper.keyDown("leftArrow"); // -> [01]:03 AM
@@ -121,8 +117,8 @@
UIHelper.keyDown(","); // -> 01:[07] AM
UIHelper.keyDown("8"); // -> 01:[08] AM
shouldBeEqualToString("input.value", "01:08");
- shouldBe("changeEventsFired", "7");
- shouldBe("inputEventsFired", "7");
+ shouldBe("changeEventsFired", "6");
+ shouldBe("inputEventsFired", "6");
beginTest("Up/Down arrow keys", "23:59"); // [11]:59 PM
UIHelper.keyDown("upArrow"); // -> [12]:59 PM
Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (272951 => 272952)
--- branches/safari-611-branch/Source/WebCore/ChangeLog 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog 2021-02-17 01:17:09 UTC (rev 272952)
@@ -1,5 +1,120 @@
2021-02-16 Ruben Turcios <rubent...@apple.com>
+ Cherry-pick r272495. rdar://problem/74409320
+
+ [macOS] Return key binding for date inputs conflicts with return to submit form
+ https://bugs.webkit.org/show_bug.cgi?id=221532
+ <rdar://problem/74039204>
+
+ Reviewed by Wenson Hsieh.
+
+ Source/WebCore:
+
+ Currently, pressing the return key within a focused date input presents
+ the calendar view, rather than submitting an associated form. This is a
+ usability issue for keyboard users, and is different from the behavior
+ in Chrome. This patch matches the behavior in Chrome, and makes it so
+ that a return keypress submits an associated form.
+
+ However, since the return key is now reserved for form submission, we
+ need a new key to present the calendar view for the date input. Chrome
+ and Firefox use the space key for this functionality, so this patch
+ matches that behavior.
+
+ Note that r267281 updated date inputs to focus the next editable component
+ when pressing the space key. This behavior is now removed in favor of
+ presenting the calendar. Other separator keys, and arrow keys, can still be
+ used to focus the next editable component.
+
+ Tests: fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html
+ fast/forms/date/date-editable-components/form-submit-on-return-keypress.html
+
+ * html/BaseDateAndTimeInputType.cpp:
+ (WebCore::BaseDateAndTimeInputType::handleKeypressEvent):
+
+ Date and time inputs are BaseClickableWithKeyInputTypes. This gives them
+ activation behavior on return and space keypresses, similar to button and
+ color inputs. However, since date/time inputs are closer to textfields,
+ than buttons, we elide activation behavior on a return keypress, allowing
+ the event to submit an associated form. Activation behavior on a space
+ keypress is supported by going through the existing code path.
+
+ * html/shadow/DateTimeFieldElement.cpp:
+ (WebCore::DateTimeFieldElement::defaultKeyboardEventHandler):
+
+ Remove "Space" from the list of separator keys that focus the next
+ editable component.
+
+ LayoutTests:
+
+ Added tests to verify that pressing the space key in a focused date
+ input presents a calendar view, and pressing the enter key in a focused
+ date input submits a form.
+
+ Rebaselined existing tests to account for the fact that the space key
+ no longer focuses the next editable component within a date input.
+
+ * fast/forms/date/date-editable-components/date-editable-components-keyboard-events-expected.txt:
+ * fast/forms/date/date-editable-components/date-editable-components-keyboard-events.html:
+ * fast/forms/date/date-editable-components/date-picker-show-on-space-keypress-expected.txt: Added.
+ * fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html: Added.
+ * fast/forms/date/date-editable-components/form-submit-on-return-keypress-expected.txt: Added.
+ * fast/forms/date/date-editable-components/form-submit-on-return-keypress.html: Added.
+ * fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events-expected.txt:
+ * fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-editable-components-keyboard-events.html:
+ * fast/forms/month/month-editable-components/month-editable-components-keyboard-events-expected.txt:
+ * fast/forms/month/month-editable-components/month-editable-components-keyboard-events.html:
+ * fast/forms/time/time-editable-components/time-editable-components-keyboard-events-expected.txt:
+ * fast/forms/time/time-editable-components/time-editable-components-keyboard-events.html:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-02-08 Aditya Keerthi <akeer...@apple.com>
+
+ [macOS] Return key binding for date inputs conflicts with return to submit form
+ https://bugs.webkit.org/show_bug.cgi?id=221532
+ <rdar://problem/74039204>
+
+ Reviewed by Wenson Hsieh.
+
+ Currently, pressing the return key within a focused date input presents
+ the calendar view, rather than submitting an associated form. This is a
+ usability issue for keyboard users, and is different from the behavior
+ in Chrome. This patch matches the behavior in Chrome, and makes it so
+ that a return keypress submits an associated form.
+
+ However, since the return key is now reserved for form submission, we
+ need a new key to present the calendar view for the date input. Chrome
+ and Firefox use the space key for this functionality, so this patch
+ matches that behavior.
+
+ Note that r267281 updated date inputs to focus the next editable component
+ when pressing the space key. This behavior is now removed in favor of
+ presenting the calendar. Other separator keys, and arrow keys, can still be
+ used to focus the next editable component.
+
+ Tests: fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html
+ fast/forms/date/date-editable-components/form-submit-on-return-keypress.html
+
+ * html/BaseDateAndTimeInputType.cpp:
+ (WebCore::BaseDateAndTimeInputType::handleKeypressEvent):
+
+ Date and time inputs are BaseClickableWithKeyInputTypes. This gives them
+ activation behavior on return and space keypresses, similar to button and
+ color inputs. However, since date/time inputs are closer to textfields,
+ than buttons, we elide activation behavior on a return keypress, allowing
+ the event to submit an associated form. Activation behavior on a space
+ keypress is supported by going through the existing code path.
+
+ * html/shadow/DateTimeFieldElement.cpp:
+ (WebCore::DateTimeFieldElement::defaultKeyboardEventHandler):
+
+ Remove "Space" from the list of separator keys that focus the next
+ editable component.
+
+2021-02-16 Ruben Turcios <rubent...@apple.com>
+
Cherry-pick r272488. rdar://problem/74410510
Perform layout before running Editor::findString
Modified: branches/safari-611-branch/Source/WebCore/html/BaseDateAndTimeInputType.cpp (272951 => 272952)
--- branches/safari-611-branch/Source/WebCore/html/BaseDateAndTimeInputType.cpp 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/Source/WebCore/html/BaseDateAndTimeInputType.cpp 2021-02-17 01:17:09 UTC (rev 272952)
@@ -418,6 +418,11 @@
void BaseDateAndTimeInputType::handleKeypressEvent(KeyboardEvent& event)
{
+ // The return key should not activate the element, as it conflicts with
+ // the key binding to submit a form.
+ if (event.charCode() == '\r')
+ return;
+
ASSERT(element());
BaseClickableWithKeyInputType::handleKeypressEvent(*element(), event);
}
Modified: branches/safari-611-branch/Source/WebCore/html/shadow/DateTimeFieldElement.cpp (272951 => 272952)
--- branches/safari-611-branch/Source/WebCore/html/shadow/DateTimeFieldElement.cpp 2021-02-17 01:16:51 UTC (rev 272951)
+++ branches/safari-611-branch/Source/WebCore/html/shadow/DateTimeFieldElement.cpp 2021-02-17 01:17:09 UTC (rev 272952)
@@ -118,7 +118,7 @@
return;
}
- if ((key == "Right" || code == "Comma" || code == "Minus" || code == "Period" || code == "Space" || code == "Slash" || code == "Semicolon")
+ if ((key == "Right" || code == "Comma" || code == "Minus" || code == "Period" || code == "Slash" || code == "Semicolon")
&& m_fieldOwner && m_fieldOwner->focusOnNextField(*this)) {
keyboardEvent.setDefaultHandled();
return;