@Override
    protected void onPreviewNativeEvent(final NativePreviewEvent event) {
        super.onPreviewNativeEvent(event);

        final NativeEvent nativeEvent = event.getNativeEvent();
        final Action action = KeyBinding.test(nativeEvent);
        if (event.getTypeInt() == Event.ONKEYDOWN) {
            final EventTarget eventTarget = nativeEvent.getEventTarget();
            final boolean isEditor;
            if (eventTarget != null) {
                final Element element = Element.as(eventTarget);
//                GWT.log("element: " + element.getTagName() + "." + element.getClassName());
                // We should not be handling key down events if the target is the ACE editor
                // as this messes with things like code completion, vim bindings, etc.
                // If the user is focused on something other than the editor then it's all fine.
                isEditor = element != null && element.hasClassName("ace_text-input");
            } else {
                isEditor = false;
            }

            if (!isEditor) {
                if (action != null) {
                    switch (action) {
                        case CLOSE:
                            // Cancel the event so ancestors don't also handle it
                            event.cancel();
                            onCloseAction();
                            break;
                        case OK:
                            // Cancel the event so ancestors don't also handle it
                            event.cancel();
                            onOkAction();
                            break;
                    }
                }
            }
        }
    }
Notify the dialog when either the Enter or Escape key is pressed.
For dialogs with a close button, the Escape will cause them to close.
The combination Ctrl+Enter key will close the dialog, with a `true` result.
stroom-core-client-widget/src/main/java/stroom/widget/popup/client/view/AbstractPopupPanel.java