Emoji Tooltip: Open without focus on the first emoji (#3366)

This commit is contained in:
Alexander Zinchuk 2023-07-05 13:14:03 +02:00
parent e82b6110ac
commit 10d4e6b9fa
2 changed files with 3 additions and 0 deletions

View File

@ -122,6 +122,7 @@ const EmojiTooltip: FC<OwnProps> = ({
isActive: isOpen, isActive: isOpen,
isHorizontal: true, isHorizontal: true,
items: listEmojis, items: listEmojis,
shouldRemoveSelectionOnReset: true,
onSelect: handleSelect, onSelect: handleSelect,
onClose, onClose,
}); });

View File

@ -44,6 +44,8 @@ export function useKeyboardNavigation({
const handleItemSelect = useLastCallback((e: KeyboardEvent) => { const handleItemSelect = useLastCallback((e: KeyboardEvent) => {
// Prevent action on key combinations // Prevent action on key combinations
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return false; if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return false;
if (!isActive) return false;
if (items && items.length && selectedItemIndex > -1) { if (items && items.length && selectedItemIndex > -1) {
const item = items[selectedItemIndex]; const item = items[selectedItemIndex];
if (item) { if (item) {