public inbox for [email protected]
help / color / mirror / Atom feedFrom: Aditya Toshniwal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM3523] Right clicking a browser object does not apply to the object on which right click was fired.
Date: Fri, 10 Apr 2020 15:29:52 +0530
Message-ID: <CAM9w-_mUCG9t=bFq9W0dCTQ2MY6rX3wzxGHf5eBJR-h8Tk4EdQ@mail.gmail.com> (raw)
Hi Hackers,
Attached is the patch to fix a context menu issue where Ctrl+Click a
browser object opens the context menu, but the menu operations does not
apply on the item selected.
The patch also fixes keyboard navigation on the context menu applied to
browser tree.
Please review.
--
Thanks and Regards,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] RM3523.patch (1.1K, 3-RM3523.patch)
download | inline diff:
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index 984d247d3..aa0a57057 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -371,6 +371,27 @@ export class Tree {
}
}.bind(this));
this.aciTreeApi = $treeJQuery.aciTree('api');
+
+ /* Ctrl + Click will trigger context menu. Select the node when Ctrl+Clicked.
+ * When the context menu is visible, the tree should lose focus
+ * to use context menu with keyboard. Otherwise, the tree functions
+ * overrides the keyboard events.
+ */
+ let contextHandler = (ev)=>{
+ let treeItem = this.aciTreeApi.itemFrom(ev.target);
+ if(treeItem.length) {
+ if(ev.ctrlKey) {
+ this.aciTreeApi.select(treeItem);
+ }
+ $(treeItem).on('contextmenu:visible', ()=>{
+ $(treeItem).trigger('blur');
+ $(treeItem).off('contextmenu:visible');
+ });
+ }
+ };
+ $treeJQuery
+ .off('mousedown', contextHandler)
+ .on('mousedown', contextHandler);
}
/**
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin][RM3523] Right clicking a browser object does not apply to the object on which right click was fired.
In-Reply-To: <CAM9w-_mUCG9t=bFq9W0dCTQ2MY6rX3wzxGHf5eBJR-h8Tk4EdQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox