Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji picker suggestions are unexpected when using ":)" and ":D" #3825

Closed
jancborchardt opened this issue Feb 27, 2023 · 7 comments 路 Fixed by #3924
Closed

Emoji picker suggestions are unexpected when using ":)" and ":D" #3825

jancborchardt opened this issue Feb 27, 2023 · 7 comments 路 Fixed by #3924
Labels
1. to develop Accepted and waiting to be taken care of bug Something isn't working feature: emoji picker Related to the emoji picker component

Comments

@jancborchardt
Copy link
Contributor

When typing :) and :D, two very common text emojis, the suggestions by the emoji picker are very off. And when you just press "enter", you get very misleading emojis as a result:

:) :D
image image

Expected suggestions:

  • :) = 馃檪 :slightly_smiling_face:
  • :D = 馃槃 :smile:
@jancborchardt jancborchardt added bug Something isn't working 1. to develop Accepted and waiting to be taken care of feature: emoji picker Related to the emoji picker component labels Feb 27, 2023
@jancborchardt
Copy link
Contributor Author

In a different issue @nickvergessen mentioned to not replace :) or :D with emojis but keep them as is.

Either is fine with me design-wise, as long as the completely-wrong-emoji issue is fixed. :D

@jancborchardt
Copy link
Contributor Author

cc @max-nextcloud @mejo- one of you worked on the emoji picker, right? Maybe you know a possible solution here?

@nickvergessen
Copy link
Contributor

In a different issue nickvergessen mentioned to not replace :) or :D with emojis but keep them as is.

The question is how. The problem origins from writing the emoji and then using "Enter" to send the chat message. But since you did type a : the emoji picker is open and basically hitting enter confirms the emoji and that is also the totally expected result (for any other combination)
So you are already required to hit enter twice, once to pick the emoji and once to then afterwards submit the message.

I don't know how the emoji autocomplete works, maybe we can extend the list and add manual additional entries to it for some text based ones and make the plain text :) the first entry for those and Enter at least picks the right emoji.

Apart from :) and :D there are at least 3 more, which at least affect me regularly:

  • :(
  • :P
  • :S

@mejo-
Copy link
Contributor

mejo- commented Mar 23, 2023

Emoji picker already has the required data available, searching for :), :D and alike gives the correct results. See https://github.com/serebrov/emoji-mart-vue#emoticons.

The problem is that we actually search for ) or D, because we strip the : from the search string. We might instead always search for the full :<string> search string instead and then add additional results with the : stripped. This should work as searching for something like :smile doesn't reveal results anyway.

The relevant place in code would be here: https://github.com/nextcloud/nextcloud-vue/blob/4690b32d23a451c8a67d711c8066b191008f2050/src/functions/emoji/emoji.js#L36

The following code change should do the trick:

let results = index.search(`:${query}`, maxResults)
if (results.length < maxResults) {
    results = results.concat(index.search(query, maxResults - results.length))
}
return results

@mejo-
Copy link
Contributor

mejo- commented Mar 23, 2023

I can prepare a PR next week if others think this is a viable solution.

mejo- added a commit that referenced this issue Mar 23, 2023
Search for `:<search-query>` first and fill up missing results with
`<search-query>` (stripping the `:`). This improves results for emoji
autocompletion when typing emoticons (like `:)`, `:D`, `:P` and so on).

Fixes: #3825

Signed-off-by: Jonas <jonas@freesources.org>
@mejo-
Copy link
Contributor

mejo- commented Mar 23, 2023

I went ahead and created a (untested) PR: #3923

mejo- added a commit that referenced this issue Mar 23, 2023
Search for `:<search-query>` first and fill up missing results with
`<search-query>` (stripping the `:`). This improves results for emoji
autocompletion when typing emoticons (like `:)`, `:D`, `:P` and so on).

Fixes: #3825

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this issue Mar 23, 2023
Search for `:<search-query>` first and fill up missing results with
`<search-query>` (stripping the `:`). This improves results for emoji
autocompletion when typing emoticons (like `:)`, `:D`, `:P` and so on).

Fixes: #3825

Signed-off-by: Jonas <jonas@freesources.org>
@nickvergessen
Copy link
Contributor

nickvergessen commented Mar 24, 2023

I'll send a counter proposal soon to actually autocomplete the text as mentioned above instead of posting emojis
Bildschirmaufzeichnung vom 2023-03-24, 07-16-01.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug Something isn't working feature: emoji picker Related to the emoji picker component
Projects
None yet
3 participants