Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
popovers: Add keyboard support for starred message popovers in sidebar.
Mohit Gupta937c85d27834
diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.jsindex b550860b195..b6f92f664ef 100644--- a/frontend_tests/node_tests/hotkey.js+++ b/frontend_tests/node_tests/hotkey.js@@ -214,6 +214,7 @@ run_test("basic_chars", () => {stream_popped: return_false,topic_popped: return_false,all_messages_popped: return_false,+ starred_messages_popped: return_false,});set_global("emoji_picker", {reactions_popped: return_false,diff --git a/static/js/hotkey.js b/static/js/hotkey.jsindex 656329c6388..ea6f7d669d7 100644--- a/static/js/hotkey.js+++ b/static/js/hotkey.js@@ -316,6 +316,11 @@ exports.process_enter_key = function (e) {return true;}+ if (stream_popover.starred_messages_popped()) {+ stream_popover.starred_messages_sidebar_menu_handle_keyboard("enter");+ return true;+ }+if (overlays.settings_open()) {// On the settings page just let the browser handle// the Enter key for things like submitting forms.@@ -583,6 +588,11 @@ exports.process_hotkey = function (e, hotkey) {stream_popover.all_messages_sidebar_menu_handle_keyboard(event_name);return true;}++ if (stream_popover.starred_messages_popped()) {+ stream_popover.starred_messages_sidebar_menu_handle_keyboard(event_name);+ return true;+ }}// The next two sections date back to 00445c84 and are Mac/Chrome-specific,diff --git a/static/js/stream_popover.js b/static/js/stream_popover.jsindex 04039cdd400..d5494992004 100644--- a/static/js/stream_popover.js+++ b/static/js/stream_popover.js@@ -44,6 +44,11 @@ exports.all_messages_sidebar_menu_handle_keyboard = (key) => {popovers.popover_items_handle_keyboard(key, items);};+exports.starred_messages_sidebar_menu_handle_keyboard = (key) => {+ const items = get_popover_menu_items(starred_messages_sidebar_elem);+ popovers.popover_items_handle_keyboard(key, items);+};+function elem_to_stream_id(elem) {const stream_id = parseInt(elem.attr("data-stream-id"), 10);diff --git a/static/templates/starred_messages_sidebar_actions.hbs b/static/templates/starred_messages_sidebar_actions.hbsindex 9ba9648d090..3b95162a294 100644--- a/static/templates/starred_messages_sidebar_actions.hbs+++ b/static/templates/starred_messages_sidebar_actions.hbs@@ -1,13 +1,14 @@{{! Contents of the "starred messages sidebar" popup }}<ul class="nav nav-list">+ {{! tabindex="0" Makes anchor tag focusable. Needed for keyboard support. }}<li>- <a id="unstar_all_messages">+ <a tabindex="0" id="unstar_all_messages"><i class="fa fa-star-o" aria-hidden="true"></i>{{#tr this}}Unstar all messages{{/tr}}</a></li><li>- <a id="toggle_display_starred_msg_count">+ <a tabindex="0" id="toggle_display_starred_msg_count">{{#if starred_message_counts}}<i class="fa fa-eye-slash" aria-hidden="true"></i>{{#tr this}}Hide starred message count{{/tr}}