From f7bdd2855affd51ecb3784880fce9db0fde35d45 Mon Sep 17 00:00:00 2001 From: Lotus CI Date: Sat, 17 Oct 2026 20:06:41 -0400 Subject: [PATCH] fix(composer): Escape closes the emoji and sticker boards (#304) The board opens with focus in its search field, and its FocusTrap used the shared stopPropagation helper, which ignores Escape while an input is focused, so Escape never closed it (Chromium, Firefox, WebKit). Always close on Escape here, still stopping the key from closing the room or modal underneath. The GIF picker already uses the default. Fixes #304 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5 --- src/app/components/emoji-board/EmojiBoard.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; + }, }} >