Open Bug 318600 Opened 19 years ago Updated 2 months ago

Need text highlight feature to apply background color to selected text (inline css <span style="background-color:xxx">) / Page background color picker is misplaced

Categories

(MailNews Core :: Composition, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: harvested_from_mozilla4, Unassigned, NeedInfo)

References

(Blocks 3 open bugs, )

Details

(4 keywords, Whiteboard: [GS])

User Story

Addon (yellow marking): https://addons.thunderbird.net/en-US/thunderbird/addon/textmarker/
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

Attempting to apply a background color to a block of text in an HTML compose window applies the color to the page background instead.  HTML source code does not appear to be modified by the background-color selection.

Reproducible: Always

Steps to Reproduce:
1. Select text (in HTML compose window)
2. Click on "choose color for background" icon in HTML attributes task bar next to font selection.
3. Select a color
4. Click "OK" to apply color.


Actual Results:  
Color gets applied to page background and not to text selected.


There doesn't seem to be a workaround or any other way to highlight text with background color in HTML mail.
The desired behavior is not implemented.  One primary reason for this is that mail compose does not make use of CSS; background coloration only applies to 
the body in mail compose.

Note that using NVu, which has more advanced HTML editing, it is possible to use the toolbar to set the background color for the block-level tag (e.g. <p> or <div>) containing the selection, but not for only the selected text itself, nor for an inline tag (<span> or <b>) containing it.

The workaround is to select the text you wish to highlight, then from the menu pick   Insert | HTML.   A window will appear with the selected text (and any tags) shown in an edit buffer.  At the beginning of this buffer, add:
   <span style="background-color: yellow;">    (or whatever color you wish)
and at the end of the buffer, add
   </span>
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Component: Message Compose Window → MailNews: Composition
Ever confirmed: true
OS: Windows 2000 → All
Product: Thunderbird → Core
Hardware: PC → All
Summary: Applying background color to a block of text in an HTML compose window applies to page background instead. → Means to apply background color (highlight) to a selection in an HTML composition
Version: unspecified → Trunk
I've been using Thunderbird for a while now and hadn't noticed this issue because I don't use HTML mail at all.

One of my engineering colleagues at work is trying out Thunderbird in the hope of dumping Outlook.  He noticed this and asked me (webmaster) if it looks broken to me or not.  After testing I concluded "yes."  He's not an HTML-savvy guy, just someone trying to do his email the way he always does.  I'm guessing that Outlook must have a similar function to this for him to have attempted to use Thunderbird this way.

The UI gives the impression that background color applied to a block of text should work.  Perhaps something should be done to the UI so that users don't develop a false expectation and then conclude that Thunderbird is broken.

Possible suggestions that perhaps you can improve on:

1. Currently, hovering over the background-color icon in HTML attributes task bar gives a tooltip that says "Choose color for background."  If a text selection has been made the by user, s/he would expect this action to operate on the selection.

Perhaps tooltip should say something like "Choose background color for this message" so that user should not expect the text selection to be affected.

2. When user clicks on background-color icon in HTML attributes task bar, the color-selection pallette that opens is misleadingly entitled "Block background color."

Since it doesn't affect the "block" of text selected, perhaps change it to something like "Message background color."

Blocks: 366671
Assignee: mscott → nobody
QA Contact: composition
Product: Core → MailNews Core
Is there anything that prevent to implement in the UI the manual solution proposed in comment#1 in TB3?
I test it and it works well:
 <span style="background-color: yellow;"> 
 My word with yellow background
 </span>

I received the message on gmail with the correct background.
Flags: wanted-thunderbird3?
Also, this bug should be linked to Bug 423488 -  Outlook Express/Outlook parity bugs  because Outlook (or Gmail, ...) has this feature.
Source: http://office.microsoft.com/en-us/outlook/HA101671421033.aspx

Note that Windows Live Mail doesn't have this feature (source: http://email.about.com/od/windowsmailtips/qt/et_highlight.htm ).
Last new, I found an Add-ons that do the job: Highlight Text, available here: https://addons.mozilla.org/fr/thunderbird/addon/6509

However, I think this should be solve in core, not by an Add-on.
I agree - this would be a very useful feature
I've recently switched an organization (+60 computers) from Outlook to Thunderbird and one of the few recurrent complaints afterward was the lack of text highlighter functionality.

This should be considered as a low cost high reward addition for Thunderbird 3.1.
@low cost high reward addition for Thunderbird: 
my thoughts exactly!
Ok, so here is what I don't understand:

(1) In SeaMonkey, if I open the Composer, there is a button "Choose highlight color for text" next to the fore/background color pickers which is exactly doing what's asked for here, i.e., inserting an HTML <span> element with style="background-color: rgb(255, 255, 0);" attribute (that's yellow in this case).

(2) Neither Thunderbird's Mail/News HTML editor nor SeaMonkey's offer that button in the formatting toolbar, though the editor should be the same as composer. This works when using Insert > HTML and manually entering the Composer-generated code as is, and is displayed properly with View > Message Body As > Original HTML.

(3) mail/components/compose/content/editorOverlay.xul has a <toolbarbutton id="HighlightColorButton" ... command="cmd_highlight"> defined, yet it doesn't show up.

Thus, is the highlight button hidden for some specific reason (i.e., won't work in Mail/News as suggested in comment #1, which may no longer apply), or does it "just" need to be made available in the (non-customizable) formatting bar to expose that functionality?
Unfortunately it's not that simple. I've made the button available by adding <toolbarbutton id="HighlightColorButton"/> after "color-buttons-container" in messengercompose.xul and it indeed showed up (except for the missing toolbar button icon). The HTML code inserted was <font bgcolor="..."> however, thus apparently more needs to be updated in the mail/suite branches to follow the editor implementation changes. Anyway, this was worth a try...
(In reply to caméléon from comment #7)
> Last new, I found an Add-ons that do the job: Highlight Text, available
> here: https://addons.mozilla.org/fr/thunderbird/addon/6509

Hi caméléon, this add-on seems to have been removed since, no luck with https://addons.mozilla.org/thunderbird/addon/highlight-text/

Is there some replacement for this which users can be directed to instead?
@ rsx11m
It can be used add-on Highlighter instead:

https://addons.mozilla.org/de/thunderbird/addon/highlighter-222207/
No longer blocks: 366671
Depends on: 97840
See also: SM bug bug 489067, which if I understand bug 489067 comment 7 correctly has an intention of fixing this for SM only.
See Also: → 489067
Summary: Means to apply background color (highlight) to a selection in an HTML composition → Need text highlight feature to apply background color to selected text (inline css <span style="background-color:xxx">) / Page background color picker is misplaced
(In reply to Will Pittenger from bug 921363, comment #2)
> While I do a lot of coding, very little is
> Javascript.  I'm rather clumsy there.  Most of what I do these days is C# or
> Java.  And none of that resembles a website.  I'm familiar with XUL, but
> find XBL confusing.

Will, thanks for informative reply on your duplicate bug 921363. With that professional skill set, I'd believe you will be very capable of fixing this. The javascript required here can't be very much and probably obtainable by copy & paste from similar formats like text color (the other half of the color palette button).

I think it's more a matter of finding the right component and the right spot in code where we have to fix this. But Ian Neil could certainly be helpful with that and happily support you here...

(In reply to Ian Neal from bug 489067, comment #4)
> This is probably something in the shared editor/ui code, as you can also see
> it if you go into SeaMonkey Composer and use the formatting toolbar icons. I
> imagine it would be fairly easy to add a format text background color...
> menu item

Ian, could you help us to find the right product/component and a starting point in code where this could be fixed? With such information, we might manage to lure Will (reporter of duplicate bug 921363) into fixing this long-standing popular nuisance as he has a genuine interest in the feature and the general skillset required ;)
Flags: needinfo?(iann_bugzilla)
Some more preliminary info from Ian's in bug 489067 comment 8:
The XUL code itself is forked between TB and SM but the JS code that the XUL needs to use isn't.
http://mxr.mozilla.org/comm-central/search?string=EditorSelectColor&filter=[Ee]ditorSelectColor
(In reply to Thomas D. (away till 23rd Oct) from comment #22)
> Some more preliminary info from Ian's in bug 489067 comment 8:
> The XUL code itself is forked between TB and SM but the JS code that the XUL
> needs to use isn't.

It may be easier to fix for SeaMonkey given that the code in question is active already in its composer. Then, modifications in the suite/ tree can be ported to mail/ in this bug. On the other hand, if changing the JS code breaks the respective other application, and if the majority of action is going to happen in editor/ui/composer anyway, it would make sense to fix everything in the same bug (in which case the other bug can be simply closed once done).
See Also: → 1062093
Only 1 problem / Bug report, <https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines#Open_a_new_bug_report_for_each_issue!>!
So may be we should handle the "confusing UI" problem in a separate Bug like "Bug 1062093 - Misleading arrangement of 'text color' <-> 'page background color' chips"?
Same problem in composer!

And what is the difference between this one and "Bug 121210 - Implement text highlight feature to apply background color to selected text (inline css <span style="background-color:xxx">) / Page background color picker is misplaced"?
(In reply to Rainer Bielefeld from comment #26)
> So may be we should handle the "confusing UI" problem in a separate Bug like
> "Bug 1062093 - Misleading arrangement of 'text color' <-> 'page background
> color' chips"?

I think the original report here refers to just a single issue: The background colorpicker applies the change to the document <body> where the expectation is that the change is applied to the selected text only by introducing a <span> element around it (which is what the foreground colorpicker does).

You still want to be able to pick a background color for the whole message, possibly by introducing another icon for the body background color and tweaking the existing ones for the selection background color. Bug 97840 alternatively suggests to keep current overlapping icons but let their behavior vary (body background if no text selected, highlight text is one is selected).

(In reply to Rainer Bielefeld from comment #27)
> And what is the difference between this one and "Bug 121210 - Implement text
> highlight feature to apply background color to selected text (inline css
> <span style="background-color:xxx">) / Page background color picker is
> misplaced"?

Don't see any. In fact, the title appears to be partially copy-pasted from the bug here.

We may consider 3 bugs though for the individual steps: (1) this bug here to establish any backend changes; (2) UI work necessary for Thunderbird's composition window, like new buttons; similarly, SeaMonkey bug 489067 can handle any UI work for SeaMonkey's Mail/News Composition and Composer windows.
There are two surprising things:
1. TB doesn't know this very basic feature
2. Eleven years after the feature request it is still debated what the requested feature was. 

If it counts then I vote for this feature. 

It is very important in corporate environment (as well) to emphasize the point of my thoughts. As a developer, I frequently paste code snippets for the colleagues to compare them. Highlighting the difference with some background color is way much better than applying bold or red characters because less visible differences, for example comma versus semicolon, can stay hidden if the background color is the same.

Please add this feature to TB. Thanks.
We have several Bus in this area (MailNews and SeaMonkey HTML Composer), some cleanup will be required.

The problem also affects SeaMonkey HTML-Webpage-Composer

Bug 121210 - Implement text highlight feature to apply background color to selected text (inline css <span style="background-color:xxx">) / Page background color picker is misplaced (edit)

Bug 489067 - [SM] Allow inline background color for selected text in Message Compose

Bug 1062093 - Misleading arrangement of 'text color' <-> 'page background color' chips
See Also: → 121210
The foreground/background color selector item on the toolbar should apply *ONLY* to selected text. 

Foreground color works correctly. 
Background color does not work as expected. 
Current (wrongful) behaviour is:
- if cursor in table, change background of current cell
- if cursor outside table, change background for entire page. 

Correct behaviour should be:
- regardless of cursor position, apply only to selected text, set selected text background color (ie highlight)

HTML equivalent is: <span style="color:#112233">highlighted text</span>

Gah, 14 years to get text highlight? I spent a bit of time fiddling around in TB68 today wondering why it wasn't working, before I decided to search and stumbled onto this rats nest of bugreports & crosslinked issues. I'm sorry to sound ungrateful but this is a really basic editing feature. Even TextEdit has it.

Then, just when you think you'll be saved by some kind soul developing an AddOn, you find this:
https://addons.thunderbird.net/en-US/thunderbird/addon/highlighter-222207/
where the developer laments:
"I am trying to work on a version for Thunderbird 68. I will keep you posted. In the mean time, use Thunderbird 60, or another software..
November 2019, the situation is still the same. I list it here, so people can understand:

I really hope the situation improves, good luck to us all.

See Also: 121210

(In reply to Luke Hamburg from comment #32)

Then, just when you think you'll be saved by some kind soul developing an AddOn, you find this:
https://addons.thunderbird.net/en-US/thunderbird/addon/highlighter-222207/

This one works with TB 78 for yellow markings:
https://addons.thunderbird.net/en-US/thunderbird/addon/textmarker/

User Story: (updated)

John, here's a user who was frustrated not to find proper thunderbird addon documentation 10 months back. Can you share some good news?

I don't know if he had intentions of providing this missing feature through an addon.
There's one addon for the most basic case, yellow marking (see user story).

(In reply to Luke Hamburg from comment #32)

Gah, 14 years to get text highlight?

Yeah, sorry Luke, sh...abby things happen... It's actually more than that, and yes, that's odd. Reasons are complex, the fix is potentially complex, and even though it's annoying, it's just one issue between many others. We're fixing a lot of things, but fixing everything at the same time is way beyond our current manpower...

Then, just when you think you'll be saved by some kind soul developing an AddOn, you find this:
https://addons.thunderbird.net/en-US/thunderbird/addon/highlighter-222207/
where the developer laments:
"I am trying to work on a version for Thunderbird 68. I will keep you posted. In the mean time, use Thunderbird 60, or another software..
November 2019, the situation is still the same. I list it here, so people can understand:

  • No single entry points to Thunderbird addons development, but multiple pages scattered on multiple domains owned or not by Mozilla.
    [Snip]

I think the situation has improved much since you wrote this 10 months ago, and John will have good news for you wrt Thunderbird addon documentation.

I'm not sure why we would need to worry much about the hosting as long as we can connect and communicate... (pls be respectful).
That's an official forum entertained by Thunderbird, so you could actually get help there now.

At this point, it seems both the API and the documentation are going through a phase of change, I will wait for this to be finished. Unfortunately, this situation is ridiculous, both for the add-ons developers and the users."
I really hope the situation improves, good luck to us all.

You're lucky! John will know more :-)

Flags: needinfo?(john)

Hi there,
we now have our own documentation:
https://developer.thunderbird.net

The menu on the left side has an entire add-on section further down. The entry point is:
https://developer.thunderbird.net/add-ons/about-add-ons

It covers current and past add-on types. An introduction to the new MailExtension type is here:
https://developer.thunderbird.net/add-ons/mailextensions

This is still new and has room for improvements, but I think it does contain all the relevant information at one place. The official communication channels are listed here:
https://developer.thunderbird.net/add-ons/community

Since the composeScript API works on the compose editor like a webpage does, chances are high an add-on can insert <span> blocks around selected text to change its background color with something like this:
https://stackoverflow.com/questions/3997659/replace-selected-text-in-contenteditable-div

Flags: needinfo?(john)

Awesome, thanks John!
John is our expert for all things add-on!

15 duplicates and counting...

Alex, if you want to bring a bit of joy to users by fulfilling this long-standing, ever-recurring wish - here's the place!
Being able to highlight important passages or words in an email message does sound like a useful and reasonable request.

Perhaps we could copy editor's node logics from similar commands like Bold.

(In reply to Andrei Boros from comment #40)

meanwhile https://addons.thunderbird.net/en-US/thunderbird/addon/highlighter-222207/ has been removed by the author :-(

Andrei, this one works for TB 78 (as pointed out in my comment 36 which you may have missed):

https://addons.thunderbird.net/en-US/thunderbird/addon/textmarker/

Severity: normal → S3
Keywords: parity-Outlook

added based on comment #9

You need to log in before you can comment on or make changes to this bug.