Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

composebox_typeahead: Fix bug in global time backspace & delete cases.

YashRE42e17c96d86dee
diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js
index eff9c2c35d6..ecbc7365890 100644
--- a/static/js/composebox_typeahead.js
+++ b/static/js/composebox_typeahead.js
@@ -793,17 +793,13 @@ export function show_flatpickr(element, callback, default_timestamp, options = {
disableMobile: true,
onKeyDown: (selectedDates, dateStr, instance, event) => {
if (is_numeric_key(event.key)) {
- // Don't stopPropagation for numeric inputs, let them be handled normally
+ // Don't attempt to get_keydown_hotkey for numeric inputs
+ // as it would return undefined.
return;
}
const hotkey = get_keydown_hotkey(event);
- if (hotkey === "backspace" || hotkey === "delete") {
- // Don't stopPropagation for backspace or delete, let them be handled normally
- return;
- }
-
if (["tab", "shift_tab"].includes(hotkey.name)) {
const elems = [
instance.selectedDateElem,
@@ -830,7 +826,8 @@ export function show_flatpickr(element, callback, default_timestamp, options = {
container.on("keydown", (e) => {
if (is_numeric_key(e.key)) {
- return true; // Let users type numeric values
+ // Let users type numeric values
+ return true;
}
const hotkey = get_keydown_hotkey(e);
@@ -840,7 +837,8 @@ export function show_flatpickr(element, callback, default_timestamp, options = {
}
if (hotkey.name === "backspace" || hotkey.name === "delete") {
- return true; // Let backspace or delete be handled normally
+ // Let backspace or delete be handled normally
+ return true;
}
if (hotkey.name === "enter") {