Tuesday, February 16, 2010

ToolTips: What could Flex 4 do better?

In UI there has been a long standing problem around what to do when some text doesn't fit a given area. The 1st reaction is to wrap the text. If it still doesn't fit, the 2nd reaction is to place a truncation indicator like "long label ..." and the 3rd reaction is to ask for a tooltip for the truncated text.

Flex 4 provides a semi-useful class Textbase to address this.

I use the word semi-useful because Flex 4 got the "when to show the tooltip" logic semi-wrong in my opinion. The tooltip shows up anytime the text has to wrap ... whereas it should really show up when the text actually gets truncated.

What is the point of a tooltip when the wrapped text happens to fit just fine within the provided area, without getting truncated? If you say maxDisplayedLines="2" and then you have:

label1 [no tooltip]

label2 which [shows tooltip]

label3 which [shows tooltip]
wraps and...

It feels very confusing as to why label2 has a tooltip and label1 does not. Unless you read this blog or figure it out for yourself you may even think that the tooltip behaviour is a bit inconsistent. So I think there's some room for improvement here.


  1. Sounds like we should post this on Adobe JIRA.

  2. If you're using the Label control, there's a "showTruncationTooltip" property which lets you only show the tooltip when the text is truncated.

    A nice addition, I thought.