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`.
This commit is contained in:
Junyao Chen 2023-08-25 23:01:30 -04:00 committed by Tim Abbott
parent 789d052116
commit 721fbb1bed

View File

@ -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