Bug 1857788 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

STR (observed on Windows 10, Thunderbird 115.3.1):

1. open a new html compose window
2. click into the editor
3. select a font, for example Calibri
4. type "123"
5. hit enter
6. select a smiley from the smiley drop-down menu
7. observe the smiley NOT being inserted

From what I can see, execCommand used [here](https://searchfox.org/comm-central/rev/21e9fed6d4a66d33d9db0ee8b9c1e6e944785fff/mail/components/compose/content/ComposerCommands.js#1670) fails if the following 2 elements are coming together (as in this STR)
* using font tag
* having the current cursor position before a <br>

Redo the STR but after step 5, check the source code of the editor using the html source editor add-on: https://addons.thunderbird.net/addon/html-source-editor/

You will see something like this:

```
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>

<body>
    <p>
        <font face="Calibri">123</font>
    </p>
    <p>
        <font face="Calibri"><br></font>
    </p>
</body>

</html>
```

The current cursor position before inserting the smiley is inside the font tag before the <br> tag. The newline is due to the entire <p> tag. The <br> tag is actually hidden.

After you have tried to insert the smiley, the cursor will have moved up one line and will be behind "123". The source code will look like so:

```
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>

<body>
    <p>
        <font face="Calibri">123</font>
    </p>
</body>

</html>
```

The second <p> tag is removed.

The following extra steps prevent the bug:

1. open a new html compose window
2. click into the editor
3. select a font, for example Calibri
4. type "123"
5. hit enter
5a. type "1"
5b. move the cursor back before the just typed "1"
6. select a smiley from the smiley drop-down menu
7. observe the smiley being inserted
STR (observed on Windows 10, Thunderbird 115.3.1):

1. open a new html compose window
2. click into the editor
3. select a font, for example Calibri
4. type "123"
5. hit enter
6. select a smiley from the smiley drop-down menu
7. observe the smiley NOT being inserted

From what I can see, execCommand used [here](https://searchfox.org/comm-central/rev/21e9fed6d4a66d33d9db0ee8b9c1e6e944785fff/mail/components/compose/content/ComposerCommands.js#1670) fails if the following 2 elements are coming together (as in this STR)
* using font tag
* having the current cursor position before a <br>

Redo the STR but after step 5, check the source code of the editor using the html source editor add-on: https://addons.thunderbird.net/addon/html-source-editor/

You will see something like this:

```
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>

<body>
    <p>
        <font face="Calibri">123</font>
    </p>
    <p>
        <font face="Calibri"><br></font>
    </p>
</body>

</html>
```

The current cursor position before inserting the smiley is inside the font tag before the <br> tag. The newline is due to the entire <p> tag. The <br> tag is actually hidden.

After you have tried to insert the smiley, the cursor will have moved up one line and will be behind "123". The source code will look like so:

```
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>

<body>
    <p>
        <font face="Calibri">123</font>
    </p>
</body>

</html>
```

The second <p> tag is removed.

The following extra steps prevent the bug:

1. open a new html compose window
2. click into the editor
3. select a font, for example Calibri
4. type "123"
5. hit enter
5a. type "1"
5b. move the cursor back before the just typed "1"
6. select a smiley from the smiley drop-down menu
7. observe the smiley being inserted

Not using a font will also not trigger the bug with the original STR.

Back to Bug 1857788 Comment 0