Tooltips for selected text
Most applications use terms that the user is encountering for the first time. And so, it's helpful to provide a glossary of sorts so they may look up the meaning of a new term. However, deciding on where to put this glossary inside the user interface is a big deal. For example, if I'm performing some task, I don't want to drop it to go look something up. This is where tooltips help—the user gets a contextual explanation of something.
Out of the box, tooltips work great when applied to a specific element on the page, such as a button or a progress bar. But what about paragraphs of text? Let's look at how we could allow the user to select some text, and display some contextual definition for the selection using the tooltip widget.
How to do it...
We'll design a new dictionary widget, based on the tooltip widget, used to work with text. This widget will handle text selection by displaying a tooltip with the appropriate tip if one is found. First, here are the paragraphs...