summaryrefslogtreecommitdiffstats
path: root/toolkit/content/widgets/datetimebox.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--toolkit/content/widgets/datetimebox.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/toolkit/content/widgets/datetimebox.js b/toolkit/content/widgets/datetimebox.js
index 04ed398bd7..1c63b09269 100644
--- a/toolkit/content/widgets/datetimebox.js
+++ b/toolkit/content/widgets/datetimebox.js
@@ -650,6 +650,10 @@ this.DateTimeBoxWidget = class {
onKeyDown(aEvent) {
this.log("onKeyDown key: " + aEvent.key);
+ if (aEvent.defaultPrevented) {
+ return;
+ }
+
switch (aEvent.key) {
// Toggle the picker on Space/Enter on Calendar button or Space on input,
// close on Escape anywhere.
@@ -691,21 +695,17 @@ this.DateTimeBoxWidget = class {
aEvent.preventDefault();
break;
}
- if (this.isEditable()) {
- // TODO(emilio, bug 1571533): These functions should look at
- // defaultPrevented.
- // Ctrl+Backspace/Delete on non-macOS and
- // Cmd+Backspace/Delete on macOS to clear the field
- if (aEvent.getModifierState("Accel")) {
- // Clear the input's value
- this.clearInputFields(false);
- } else {
- let targetField = aEvent.originalTarget;
- this.clearFieldValue(targetField);
- this.setInputValueFromFields();
- }
- aEvent.preventDefault();
+ // Ctrl+Backspace/Delete on non-macOS and
+ // Cmd+Backspace/Delete on macOS to clear the field
+ if (aEvent.getModifierState("Accel")) {
+ // Clear the input's value
+ this.clearInputFields(false);
+ } else {
+ let targetField = aEvent.originalTarget;
+ this.clearFieldValue(targetField);
+ this.setInputValueFromFields();
}
+ aEvent.preventDefault();
break;
}
case "ArrowRight":