From 1c6bb0b97192cba55da68d1b61cb26d04af9f705 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 357026acf0d..3981d01a6aa 100644 --- a/src/components/Suggestion/suggestions.js +++ b/src/components/Suggestion/suggestions.js @@ -56,19 +56,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) },