Bubble event handled in extraKeys


#1

Hello there,

I have a codeMirror instance where I do want to handle the Esc key in a given state, or let the event bubbles if not.
So my code looks something like:

extraKeys: {
  Esc: function() {
    if (shouldHandleEsc()) {
      handleEsc();
      return null;
    }
    return false;
  }
}

The issue is that if shouldHandleEsc returns false, the keypress event does not bubble up.
It does if I have something like

extraKeys: {
  Esc: false
}

but I do want to handle it here.

I looked at the code but did not see anything about how to handle such case.
Am I missing something ?


#2

You must return CodeMirror.Pass to indicate that you did not handle the key.