ui_util: Stop propagation enter keypress when it is already handled.

This is good to do in general for these type of event handlers
and this also fixes a bug where pressing on reply button in
the recent topics will open compose with a new line since
browser assumed enter was pressed on compose_textarea since
process_enter_key returned false.
This commit is contained in:
Aman Agrawal 2021-05-08 21:11:34 +00:00 committed by Tim Abbott
parent 27b04cb7ed
commit 1212635151
1 changed files with 2 additions and 0 deletions

View File

@ -35,6 +35,8 @@ export function convert_enter_to_click(e) {
const key = e.which;
if (key === 13) {
// Enter
e.preventDefault();
e.stopPropagation();
$(e.currentTarget).trigger("click");
}
}