diff --git a/js/glowingbear.js b/js/glowingbear.js index 3a15f42..b59d04d 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -1513,6 +1513,16 @@ weechat.directive('inputBar', function() { // Double-tap Escape -> disconnect if (code === 27) { $event.preventDefault(); + + // Check if a modal is visible. If so, close it instead of disconnecting + var modals = document.querySelectorAll('.gb-modal'); + for (var modalId in modals) { + if (modals[modalId].getAttribute('data-state') === 'visible') { + modals[modalId].setAttribute('data-state', 'hidden'); + return true; + } + } + if (typeof $scope.lastEscape !== "undefined" && (Date.now() - $scope.lastEscape) <= 500) { // Double-tap connection.disconnect();