Disable 'FocusFilter'-Hotkey if command palette is visible (#5887)

Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
This commit is contained in:
Christian Günter 2022-11-25 14:42:06 +01:00 committed by GitHub
parent 9c4ebba400
commit 8c1752f13c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,7 +284,7 @@ RepoOverViewHelper.prototype.registerKeyboardShortcuts = function() {
if (document.activeElement.id === "filter") {
return;
}
if (self.focusFilterKey && event.key === self.focusFilterKey) {
if (self.focusFilterKey && event.key === self.focusFilterKey && !CommandPalette.isVisible()) {
var filterInput = document.getElementById("filter");
if (filterInput) filterInput.focus();
event.preventDefault();
@ -551,7 +551,8 @@ StageHelper.prototype.setHooks = function() {
var self = this;
document.addEventListener("keypress", function(event) {
if (document.activeElement.id !== self.ids.objectSearch
&& self.focusFilterKey && event.key === self.focusFilterKey) {
&& self.focusFilterKey && event.key === self.focusFilterKey
&& !CommandPalette.isVisible()) {
self.dom.objectSearch.focus();
event.preventDefault();
@ -2356,6 +2357,11 @@ CommandPalette.prototype.exec = function(cmd) {
}
};
// Is any command palette visible?
CommandPalette.isVisible = function(){
return CommandPalette.instances.reduce(function(result, instance){ return result || instance.elements.palette.style.display !== "none" }, false);
};
/* COMMAND ENUMERATORS */
function createRepoCatalogEnumerator(catalog, action) {