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.

left_sidebar: Fix ENTER key navigation in more conversations in DM list.

Sayam Samal63200b9e9e28
diff --git a/web/src/hotkey.js b/web/src/hotkey.js
index 6c91f6b2af4..6a052b48d7c 100644
--- a/web/src/hotkey.js
+++ b/web/src/hotkey.js
@@ -560,6 +560,14 @@ function handle_popover_events(event_name) {
// Returns true if we handled it, false if the browser should.
export function process_enter_key(e) {
+ if ($(e.currentTarget).hasClass("trigger-click-on-enter")) {
+ // If the target has the class "trigger-click-on-enter", explicitly
+ // trigger a click event on it to call the associated click handler.
+ e.preventDefault();
+ $(e.currentTarget).trigger("click");
+ return true;
+ }
+
if (popovers.any_active() && $(e.target).hasClass("navigate-link-on-enter")) {
// If a popover is open and we pressed Enter on a menu item,
// call click directly on the item to navigate to the `href`.
diff --git a/web/templates/more_pms.hbs b/web/templates/more_pms.hbs
index 121d8a04b1d..ba5ef46398a 100644
--- a/web/templates/more_pms.hbs
+++ b/web/templates/more_pms.hbs
@@ -1,5 +1,5 @@
<li id="show-more-direct-messages" class="dm-list-item dm-box bottom_left_row {{#unless more_conversations_unread_count}}zero-dm-unreads{{/unless}}">
- <a class="dm-name" tabindex="0">{{t "more conversations" }}</a>
+ <a class="dm-name trigger-click-on-enter" tabindex="0">{{t "more conversations" }}</a>
<span class="unread_count {{#unless more_conversations_unread_count}}zero_count{{/unless}}">
{{more_conversations_unread_count}}
</span>