mirror of
https://github.com/zulip/zulip.git
synced 2026-07-06 21:18:58 +08:00
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:
parent
c98bc0bd01
commit
4e43c2f32d
@ -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");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user