From 56fd1110072a17b11712a0491fe174057e4bd51f Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 10 Nov 2026 13:33:07 +0100 Subject: [PATCH] fix(suggestion): stop Escape from closing the Viewer When the emoji, mention or link picker popup was open, pressing Escape closed the whole Viewer instead of just the popup. The tiptap suggestion plugin handles Escape before the CustomKeymap extension, which normally stops the event from reaching the Viewer. The suggestion handler returns true, so ProseMirror skips the CustomKeymap handler and the event bubbles up to the Viewer. Stop propagation of Escape in the shared suggestion renderer, including when no popup was rendered. Fixes: #9482 Signed-off-by: Jonas Assisted-by: ClaudeCode:claude-opus-5-5 --- src/components/Suggestion/suggestions.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/Suggestion/suggestions.js b/src/components/Suggestion/suggestions.js index 15dce2403d5..e063dc0013f 100644 --- a/src/components/Suggestion/suggestions.js +++ b/src/components/Suggestion/suggestions.js @@ -55,19 +55,24 @@ export default ({ }, onKeyDown(props) { - if (!popup) { - return - } - if (props.event.key === 'Escape') { - popup[0].hide() - popup[0].destroy() - component.destroy() - popup = null + // Prevent Viewer from closing as well + props.event.stopPropagation() + + if (popup) { + popup[0].hide() + popup[0].destroy() + component.destroy() + popup = null + } return true } + if (!popup) { + return + } + return component.ref?.onKeyDown?.(props) },