mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
left_sidebar: Fix ENTER key navigation in more conversations in DM list.
This commit addresses the issue where pressing the ENTER key on the "more conversations" link in the direct messages list did not perform the intended action by adding a `trigger-click-on-enter` class to the element. This allows the `process_enter_key` function to explicitly trigger a click event on the element when the ENTER key is pressed, ensuring that the associated click handler is called.
This commit is contained in:
@@ -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`.
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user