Skip to content

Commit

Permalink
Merge pull request #32324 from s-alves10/fix/issue-31210
Browse files Browse the repository at this point in the history
fix: prevent default action of Enter key when selecting an emoji
  • Loading branch information
flodnv authored Dec 6, 2023
2 parents 9b71f23 + b9ac193 commit 2feaac8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/EmojiPicker/EmojiPickerMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ function EmojiPickerMenu(props) {
}
const emoji = lodashGet(item, ['types', preferredSkinTone], item.code);
onEmojiSelected(emoji, item);
// On web, avoid this Enter default input action; otherwise, it will add a new line in the subsequently focused composer.
keyBoardEvent.preventDefault();
// On mWeb, avoid propagating this Enter keystroke to Pressable child component; otherwise, it will trigger the onEmojiSelected callback again.
keyBoardEvent.stopPropagation();
return;
}

Expand Down

0 comments on commit 2feaac8

Please sign in to comment.