Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

click_handlers: Trigger click on enter keypress on icons in RT.

Aman Agrawal05f7cb77509b
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index e902ea54beb..7183383daf2 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -4,6 +4,13 @@ const util = require("./util");
const render_buddy_list_tooltip = require('../templates/buddy_list_tooltip.hbs');
const render_buddy_list_tooltip_content = require('../templates/buddy_list_tooltip_content.hbs');
+function convert_enter_to_click(e) {
+ const key = e.which;
+ if (key === 13) { // enter
+ $(e.currentTarget).click();
+ }
+}
+
exports.initialize = function () {
// MESSAGE CLICKING
@@ -346,6 +353,8 @@ exports.initialize = function () {
muting_ui.mute(stream_id, topic);
});
+ $('body').on('keydown', '.on_hover_topic_mute', convert_enter_to_click);
+
$('body').on('click', '.on_hover_topic_unmute', function (e) {
e.stopPropagation();
const stream_id = parseInt($(e.currentTarget).attr('data-stream-id'), 10);
@@ -353,6 +362,8 @@ exports.initialize = function () {
muting_ui.unmute(stream_id, topic);
});
+ $('body').on('keydown', '.on_hover_topic_unmute', convert_enter_to_click);
+
// RECENT TOPICS
$('body').on('click', '.on_hover_topic_read', function (e) {
@@ -362,6 +373,8 @@ exports.initialize = function () {
unread_ops.mark_topic_as_read(stream_id, topic);
});
+ $('body').on('keydown', '.on_hover_topic_read', convert_enter_to_click);
+
$('body').on('click', '.btn-recent-filters', function (e) {
e.stopPropagation();
recent_topics.set_filter(e.currentTarget.dataset.filter);