When you pass no arguments to the getInputMap
method, your key bindings will work only if the component is focused.
Try using getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
instead:
panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "escape pressed");
panel.getActionMap().put("escape pressed", escapeZoom);
This way the component doesn't need to have the focus, they will work when the window has the focus