mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
alert_words_ui: Use e.key instead of deprecated e.which.
Tested by making sure alert word is added when Enter is pressed in the alert word input.
This commit is contained in:
committed by
Tim Abbott
parent
98cb0e339c
commit
969874d633
@@ -111,7 +111,7 @@ run_test("add_alert_word_keypress", (override) => {
|
||||
|
||||
const event = {
|
||||
preventDefault: () => {},
|
||||
which: 13,
|
||||
key: "Enter",
|
||||
target: "#create_alert_word_name",
|
||||
};
|
||||
|
||||
|
||||
@@ -97,9 +97,8 @@ export function set_up_alert_words() {
|
||||
});
|
||||
|
||||
$("#create_alert_word_form").on("keypress", "#create_alert_word_name", (event) => {
|
||||
const key = event.which;
|
||||
// Handle Enter (13) as "add".
|
||||
if (key === 13) {
|
||||
// Handle Enter as "add".
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
const word = $(event.target).val();
|
||||
add_alert_word(word);
|
||||
|
||||
Reference in New Issue
Block a user