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:
Sayam Samal
2025-08-09 20:12:17 +05:30
committed by Tim Abbott
parent 6f6e3b9f48
commit 405c8f094d

View File

@@ -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;
}