From ab02a9a162e5a58bd92e7bb44636f683ce2ec730 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 13 Apr 2016 18:24:36 -0400 Subject: Fixed form submission with Meta+Enter keyboard shortcut --- assets/js/src/App.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'assets/js/src/App.js') diff --git a/assets/js/src/App.js b/assets/js/src/App.js index 62e091fc..3fe75640 100644 --- a/assets/js/src/App.js +++ b/assets/js/src/App.js @@ -42,7 +42,17 @@ Kanboard.App.prototype.keyboardShortcuts = function() { // Submit form Mousetrap.bindGlobal("mod+enter", function() { - $("form").submit(); + var forms = $("form"); + + if (forms.length == 1) { + forms.submit(); + } else if (forms.length > 1) { + if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') { + $(document.activeElement).parents("form").submit(); + } else if (self.get("Popover").isOpen()) { + $("#popover-container form").submit(); + } + } }); // Open board selector -- cgit v1.2.3