Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
playground_links: Add popover keyboard handling.
Daniil Fadeev79c6ff91d714
diff --git a/web/src/hotkey.js b/web/src/hotkey.jsindex 2a30117a361..d8516c46032 100644--- a/web/src/hotkey.js+++ b/web/src/hotkey.js@@ -34,6 +34,7 @@ import * as narrow_state from "./narrow_state";import * as navigate from "./navigate";import * as overlays from "./overlays";import {page_params} from "./page_params";+import * as playground_links_popover from "./playground_links_popover";import * as popover_menus from "./popover_menus";import * as popovers from "./popovers";import * as reactions from "./reactions";@@ -400,6 +401,11 @@ function handle_popover_events(event_name) {return true;}+ if (playground_links_popover.is_open()) {+ playground_links_popover.handle_keyboard(event_name);+ return true;+ }+return false;}diff --git a/web/src/playground_links_popover.js b/web/src/playground_links_popover.jsindex d5c4baa3c6b..df96e3dc6d9 100644--- a/web/src/playground_links_popover.js+++ b/web/src/playground_links_popover.js@@ -3,6 +3,7 @@ import url_template_lib from "url-template";import render_playground_links_popover_content from "../templates/playground_links_popover_content.hbs";+import * as blueslip from "./blueslip";import * as message_viewport from "./message_viewport";import * as popovers from "./popovers";import * as realm_playground from "./realm_playground";@@ -38,7 +39,7 @@ function toggle_playground_links_popover(element, playground_info) {}}-function is_open() {+export function is_open() {return Boolean($current_playground_links_popover_elem);}@@ -49,6 +50,26 @@ export function hide() {}}+function get_playground_links_popover_items() {+ if (!is_open()) {+ blueslip.error("Trying to get menu items when playground links popover is closed.");+ return undefined;+ }++ const popover_data = $current_playground_links_popover_elem.data("popover");+ if (!popover_data) {+ blueslip.error("Cannot find playground links popover data");+ return undefined;+ }++ return $("li:not(.divider):visible a", popover_data.$tip);+}++export function handle_keyboard(key) {+ const $items = get_playground_links_popover_items();+ popovers.popover_items_handle_keyboard(key, $items);+}+function register_click_handlers() {$("#main_div, #preview_content, #message-history").on("click",diff --git a/web/src/popovers.js b/web/src/popovers.jsindex c996f0e3eb8..f1a2e687007 100644--- a/web/src/popovers.js+++ b/web/src/popovers.js@@ -145,6 +145,7 @@ export function any_active() {user_card_popover.is_message_user_card_open() ||user_card_popover.is_user_card_open() ||emoji_picker.is_open() ||+ playground_links_popover.is_open() ||$("[class^='column-'].expanded").length);}