From 4e43c2f32d0c66f6cdc8a166af6da69d9172c5e8 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Wed, 11 Jun 2025 01:22:03 +0530 Subject: [PATCH] list_util: Narrow event type to `JQuery.KeyDownEvent` only. The `inside_list`, `go_down`, and `go_up` function defined in `list_util.ts` is used in `hotkey.js`. We made changes in 45e91daa14badb58df43c486c37265bcd028e2e5 to use `keydown` only in `hotkey.js`. The event type of those three functions should be `JQuery.KeyDownEvent` only. This commit fixes that. --- web/src/list_util.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/list_util.ts b/web/src/list_util.ts index 4fb4bb8a06..4408af8b2d 100644 --- a/web/src/list_util.ts +++ b/web/src/list_util.ts @@ -9,18 +9,18 @@ const list_selectors = [ "#send_later_options", ]; -export function inside_list(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): boolean { +export function inside_list(e: JQuery.KeyDownEvent): boolean { const $target = $(e.target); const in_list = $target.closest(list_selectors.join(", ")).length > 0; return in_list; } -export function go_down(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): void { +export function go_down(e: JQuery.KeyDownEvent): void { const $target = $(e.target); $target.closest("li").next().find("a").trigger("focus"); } -export function go_up(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): void { +export function go_up(e: JQuery.KeyDownEvent): void { const $target = $(e.target); $target.closest("li").prev().find("a").trigger("focus"); }