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:
Sayam Samal
2025-07-25 10:58:52 +05:30
committed by Tim Abbott
parent 9ce596fbd8
commit 63200b9e9e
2 changed files with 9 additions and 1 deletions

View File

@@ -560,6 +560,14 @@ function handle_popover_events(event_name) {
// Returns true if we handled it, false if the browser should. // Returns true if we handled it, false if the browser should.
export function process_enter_key(e) { 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 (popovers.any_active() && $(e.target).hasClass("navigate-link-on-enter")) {
// If a popover is open and we pressed Enter on a menu item, // If a popover is open and we pressed Enter on a menu item,
// call click directly on the item to navigate to the `href`. // call click directly on the item to navigate to the `href`.

View File

@@ -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}}"> <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}}"> <span class="unread_count {{#unless more_conversations_unread_count}}zero_count{{/unless}}">
{{more_conversations_unread_count}} {{more_conversations_unread_count}}
</span> </span>