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 45e91daa14
to use `keydown` only in `hotkey.js`.

The event type of those three functions should be
`JQuery.KeyDownEvent` only.

This commit fixes that.
This commit is contained in:
Prakhar Pratyush 2025-06-11 01:22:03 +05:30 committed by Tim Abbott
parent c98bc0bd01
commit 4e43c2f32d

View File

@ -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");
}