How to stop propagation on autocomplete enter

Hey together,

I have multiple editors on my page and want to jump from one codemirror editor to the next on Enter press. I have already implemented that, by listening to the keyboard events on a parent component of the editors. However, now I also want to add autocompletion, where a completion suggestion can be selected by pressing enter. How can I prevent the event from propagating there, so that the autocompletion suggestion is accepted but the focus remains in the same editor (so the enter event does not propagate to the parent?

You could check for defaultPrevented in your key event handler. That’s a good idea in general.