Commit 5fcc388b authored by Ionel Popescu's avatar Ionel Popescu Committed by Commit Bot

Open date related pickers with Enter/Space key.

This change extends the key options used to open the date related pickers
to also include Enter and Space.

This behavior is aligned with opening the select, color popup.

Tests were added to validate opening the popup with Enter/Space.

Bug: 1004997
Change-Id: If61ba755aef5436d705cb3c3c28f1ebb0c787059
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825935Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Ionel Popescu <iopopesc@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#700354}
parent 2922ab0b
......@@ -475,7 +475,9 @@ void MultipleFieldsTemporalInputTypeView::HandleKeydownEvent(
if (picker_indicator_is_visible_ &&
((event.key() == "ArrowDown" && event.getModifierState("Alt")) ||
(LayoutTheme::GetTheme().ShouldOpenPickerWithF4Key() &&
event.key() == "F4"))) {
event.key() == "F4") ||
(RuntimeEnabledFeatures::FormControlsRefreshEnabled() &&
(event.key() == "Enter" || event.key() == " ")))) {
if (PickerIndicatorElement* element = GetPickerIndicatorElement())
element->OpenPopup();
event.SetDefaultHandled();
......
<!DOCTYPE html>
<html>
<head>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
</head>
<body>
<input type=date id=date value="2019-09-10">
<script>
test(() => {
document.getElementById('date').focus();
eventSender.keyDown("Enter");
if (internals.runtimeFlags.formControlsRefreshEnabled) {
assert_not_equals(internals.pagePopupWindow, null);
} else {
assert_equals(internals.pagePopupWindow, null);
}
}, "Test opening date picker with Enter key.");
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
</head>
<body>
<input type=date id=date value="2019-09-10">
<script>
test(() => {
document.getElementById('date').focus();
eventSender.keyDown(" ");
if (internals.runtimeFlags.formControlsRefreshEnabled) {
assert_not_equals(internals.pagePopupWindow, null);
} else {
assert_equals(internals.pagePopupWindow, null);
}
}, "Test opening date picker with Space key.");
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment