From 721fbb1bed71c50027f43586b2db8da21e44aa2d Mon Sep 17 00:00:00 2001 From: Junyao Chen Date: Fri, 25 Aug 2023 23:01:30 -0400 Subject: [PATCH] keydown_util: Extend event type for `is_enter_event` function. To accommodate both keydown and keyup events, this commit updates the function signature to accept both `JQuery.KeyDownEvent` and `JQuery.KeyUpEvent` types. An example of using keyup event is in `poll_widget.ts`. --- web/src/keydown_util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/keydown_util.ts b/web/src/keydown_util.ts index 310728c644..8eb0dabae0 100644 --- a/web/src/keydown_util.ts +++ b/web/src/keydown_util.ts @@ -30,7 +30,7 @@ export function handle(opts: { }); } -export function is_enter_event(event: JQuery.KeyDownEvent): boolean { +export function is_enter_event(event: JQuery.KeyDownEvent | JQuery.KeyUpEvent): boolean { // In addition to checking whether the key pressed was an Enter // key, we need to check whether the keypress was part of an IME // composing session, such as selecting a character using a