mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
hotkey: Trigger click on target of "trigger-click-on-enter" element.
This commit fixes the "trigger-click-on-enter" functionality to correctly trigger a click event on the element that has the class "trigger-click-on-enter". The "currentTarget" was incorrectly used, which referred to the element that the event handler is bound to, instead of the actual target of the event.
This commit is contained in:
@@ -571,11 +571,11 @@ 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 ($(e.target).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");
|
||||
$(e.target).trigger("click");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user