mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-11 05:24:45 -05:00
Fixed an issue where right-clicking a browser object does not apply to the object on which right-click was fired. Fixes #3523
Fixes keyboard navigation on the context menu applied to browser tree.
This commit is contained in:
committed by
Akshay Joshi
parent
4de6b93ba8
commit
077589e08b
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user