Closed Bug 1638874 Opened 4 years ago Closed 4 years ago

Adding any emoji in the compose window throws an error

Categories

(Thunderbird :: Message Compose Window, defect)

defect

Tracking

(thunderbird_esr78 fixed, thunderbird78+ affected)

RESOLVED FIXED
Thunderbird 79.0
Tracking Status
thunderbird_esr78 --- fixed
thunderbird78 + affected

People

(Reporter: khushil324, Assigned: khushil324)

Details

Attachments

(2 files, 3 obsolete files)

error thrown in doStatefulCommand: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsICommandParams.getBooleanValue]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://messenger/content/messengercompose/ComposerCommands.js :: pokeMultiStateUI :: line 396" data: no]

ESR 68 is also affected.

Summary: Adding emoji in the compose window trows an error → Adding any emoji in the compose window throws an error

regression?

Version: unspecified → 68

Don't know if it's this one, but I there are at bunch a few commands there that cause an error (a caught one).

I will take this as I am working on the commands part in the another patch.

Assignee: nobody → khushil324

Apply patch from bug 1582410 before.

In the current implementation, we are inserting emoji as content to <span> and inserting another <span> for the text code of the smiley.

<span> // This will display content as emoji
  <span>:-)</span> // This block will be hidden through CSS.
</span>

When you try to remove this, it will need 5 keypresses to remove. First, :-) will be removed with 3 keypresses. And then, 2 <span> elements will be removed with another 2 keypresses. And we can't do much about it.

So, in this patch, I have tried moving from this implementation to like this: https://www.w3schools.com/charsets/ref_emoji_smileys.asp, inserting it through hexadecimal value: 😀 as now all browsers and editor support this.

This implementation is easy to use and there is no problem while adding or removing them. It will behave just like a character. I have submitted a WIP patch. Look at it. If everyone agrees I will go and remove all the previous smiley related images and CSS. This is also a question, do we want to keep those images and CSS to see the emoji images in previously sent/received mail? If we remove those, they will be shown text codes for those emojis only like :-) etc.

Attachment #9150964 - Flags: feedback?(mkmelin+mozilla)
Status: NEW → ASSIGNED

Just a quick query, what about plain text messages?

Flags: needinfo?(khushil324)
Comment on attachment 9150964 [details] [diff] [review]
WIP-Bug-1638874_improve-emoji-support.patch

Review of attachment 9150964 [details] [diff] [review]:
-----------------------------------------------------------------

::: mail/components/compose/content/ComposerCommands.js
@@ +2550,4 @@
>      try {
> +      let editor = GetCurrentEditor();
> +      let smileyCode = aParams.getStringValue("state_attribute");
> +      let smileyElement = editor.createElementWithDefaults("span");

shouldn't it be just a text node?
Attachment #9150964 - Flags: feedback?(mkmelin+mozilla) → feedback?

(In reply to Ian Neal from comment #6)

Just a quick query, what about plain text messages?

I don't think you can insert a (formatted) smiley in a plan text message.
We do auto detection to format smileys for incoming messages, but this bug is about inserting smileys in HTML messages.

I think we still need these images (at least for now) for the incoming plain text auto-upgrade case.

(In reply to Magnus Melin [:mkmelin] from comment #8)

(In reply to Ian Neal from comment #6)

Just a quick query, what about plain text messages?

I don't think you can insert a (formatted) smiley in a plan text message.
We do auto detection to format smileys for incoming messages, but this bug is about inserting smileys in HTML messages.

Right. Displaying smileys for the incoming messages also has some issues, it is not detecting in all the cases. That can be done in another bug.

I think we still need these images (at least for now) for the incoming plain text auto-upgrade case.

Yes, I wanted to know if we want to go on this path and what to do about the current implementation.

Flags: needinfo?(khushil324)

We need to insert the textNode through <span> element. Throws an error when you try to inject the textNode directly.

Attachment #9150964 - Attachment is obsolete: true
Attachment #9150964 - Flags: feedback?
Attachment #9151115 - Flags: review?(mkmelin+mozilla)

I think this is a good direction.
I'm not sure why the emoticons are all listed with yellow background in the menu, but the inserted ones are only sometimes with yellow... and some cases, like embarrassed therefore look slightly different in the compose body.

I am not seeing any yellow background anywhere, on Mac. Can you share a screenshot?

Attached image smile.png

I meant fill, not background. Notice how they look different in the two places.

I think this is a Linux related issue: https://askubuntu.com/questions/1029661/18-04-color-emoji-not-showing-up-at-all-in-chrome-only-partially-in-firefox
If you sent the mail and look it at the message window, you will see all the emojis in yellow background.
Do you have any idea and how to solve this?

Attachment #9151115 - Attachment is obsolete: true
Attachment #9151115 - Flags: review?(mkmelin+mozilla)
Attachment #9155220 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9155220 [details] [diff] [review]
Bug-1638874_improve-emoji-support-1.patch

Review of attachment 9155220 [details] [diff] [review]:
-----------------------------------------------------------------

I really don't know what's up with the emoji colors: with "preformat" text they are all yellow, in the menu they are all yellow. Elsehere some are not yellow.

But I still think we should go ahead with this.
Attachment #9155220 - Flags: review?(mkmelin+mozilla) → review+
Target Milestone: --- → Thunderbird 78.0

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/389202b5f371
Adding any emoji in the compose window throws an error. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined: Emoji usage is problematic.
Testing completed (on c-c, etc.):
Risk to taking this patch (and alternatives if risky): Low

Attachment #9182171 - Flags: review+
Attachment #9182171 - Flags: approval-comm-esr78?

Comment on attachment 9155220 [details] [diff] [review]
Bug-1638874_improve-emoji-support-1.patch

[Triage Comment]
Required for bug 1665174. Taking the original version of the patch rather than the esr78 version to avoid confusion as the later is combined with bug 1665174.

Attachment #9155220 - Flags: approval-comm-esr78+
Attachment #9182171 - Flags: approval-comm-esr78?
Attachment #9182171 - Attachment is obsolete: true

2020-06-15 was milestone 79, which ran 2020-06-01 to 2020-06-29.

Target Milestone: Thunderbird 78.0 → Thunderbird 79.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: