Skip to content

Commit

Permalink
Merge pull request #27711 from ahmedGaber93/issue-27156
Browse files Browse the repository at this point in the history
Reset emoji suggestion pop-up automatically after an emoji has been inserted
  • Loading branch information
MariaHCD authored Sep 20, 2023
2 parents 05a5591 + aa5f44f commit 82acaf3
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ function ComposerWithSuggestions({
setIsCommentEmpty(!!newComment.match(/^(\s)*$/));
setValue(newComment);
if (commentValue !== newComment) {
// Ensure emoji suggestions are hidden even when the selection is not changed (so calculateEmojiSuggestion would not be called).
if (suggestionsRef.current) {
suggestionsRef.current.resetSuggestions();
}

const remainder = ComposerUtils.getCommonSuffixLength(commentRef.current, newComment);
setSelection({
start: newComment.length - remainder,
Expand Down Expand Up @@ -212,7 +217,7 @@ function ComposerWithSuggestions({
debouncedBroadcastUserIsTyping(reportID);
}
},
[debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, reportID, setIsCommentEmpty],
[debouncedUpdateFrequentlyUsedEmojis, preferredLocale, preferredSkinTone, reportID, setIsCommentEmpty, suggestionsRef],
);

/**
Expand Down

0 comments on commit 82acaf3

Please sign in to comment.