diff --git a/src/app/components/emoji-board/EmojiBoard.tsx b/src/app/components/emoji-board/EmojiBoard.tsx index 91252a70f..da56c7fea 100644 --- a/src/app/components/emoji-board/EmojiBoard.tsx +++ b/src/app/components/emoji-board/EmojiBoard.tsx @@ -19,7 +19,7 @@ import { useVirtualizer } from '@tanstack/react-virtual'; import { EmojiData, IEmoji, emojiGroups, emojis, loadEmojiData } from '../../plugins/emoji'; import { useEmojiGroupLabels } from './useEmojiGroupLabels'; import { useEmojiGroupIcons } from './useEmojiGroupIcons'; -import { preventScrollWithArrowKey, stopPropagation } from '../../utils/keyboard'; +import { preventScrollWithArrowKey } from '../../utils/keyboard'; import { useRelevantImagePacks } from '../../hooks/useImagePacks'; import { useMatrixClient } from '../../hooks/useMatrixClient'; import { useRecentEmoji } from '../../hooks/useRecentEmoji'; @@ -612,7 +612,13 @@ export function EmojiBoard({ !editableActiveElement() && isKeyHotkey(['arrowdown', 'arrowright'], evt), isKeyBackward: (evt: KeyboardEvent) => !editableActiveElement() && isKeyHotkey(['arrowup', 'arrowleft'], evt), - escapeDeactivates: stopPropagation, + // [Gitea #304] The board opens with focus in its search field, where + // the shared stopPropagation helper ignores Escape. Always close here, + // without letting the key also close the room/modal underneath. + escapeDeactivates: (evt: KeyboardEvent) => { + evt.stopPropagation(); + return true; + }, }} >