diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js index 26db8374dc..f11ec30334 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js @@ -510,12 +510,24 @@ nf.Canvas = (function () { $(window).on('resize', function () { updateGraphSize(); }).on('keydown', function (evt) { + var isCtrl = evt.ctrlKey || evt.metaKey; + + // consider escape, before checking dialogs + if (!isCtrl && evt.keyCode === 27) { + // esc + nf.Actions.hideDialogs(); + + evt.preventDefault(); + return; + } + // if a dialog is open, disable canvas shortcuts if ($('.dialog').is(':visible')) { return; } - if (evt.ctrlKey || evt.metaKey) { + // handle shortcuts + if (isCtrl) { if (evt.keyCode === 82) { // ctrl-r nf.Actions.reloadStatus(); @@ -543,11 +555,6 @@ nf.Canvas = (function () { // delete nf.Actions['delete'](nf.CanvasUtils.getSelection()); - evt.preventDefault(); - } else if (evt.keyCode === 27) { - // esc - nf.Actions.hideDialogs(); - evt.preventDefault(); } }