hint messages (help text) in input box

60 views
Skip to first unread message

Jean-Pierre Rivière

unread,
Nov 20, 2020, 5:35:33 AM11/20/20
to TiddlyWiki
I'd like to have a help message appear within an input box having the focus (we call it "bulle d'aide" in French -- Help bubble, literally).

I have seen mechanism for popup in tw, but this is not what I want, or not like that (I don't want to click to make it appear). I would rather have a standard help text mechanism.

a point is, this is not supported by the wiki markup so far.

Eric Shulman

unread,
Nov 20, 2020, 5:51:48 AM11/20/20
to TiddlyWiki
Most of the input widgets ($edit-text, $checkbox, $radio) widgets don't support a tooltip="..." parameter (note: $select DOES have a tooltip="..." param)

However, as an easy workaround, you can wrap the input widget side a <span> that specifies a title="..." param, like this:

<span title="enter something here">
<$edit-text tiddler="temp" field="foo" />
</span>

Note: this method can also be used to add a mouseover tooltip to ANY content, even plain text.  Thus:

This text is before
<span title="tooltip text goes here"> foo baz baz mumble frotz gronk snork snerfle plurm </span>
this text is after

enjoy,
-e

Jean-Pierre Rivière

unread,
Nov 20, 2020, 6:08:36 AM11/20/20
to TiddlyWiki
Really cool and very fast answer indeed!!!! THANK YOU!!!!

I was about to write I forgot to mention that the $edit-text widget have a focusPopup property, which I have not found out how to use. I saw it apparently required the widget having css class tc-popup-handle. I put my help in focusPopup, but not directly: I use a tiddler name "grid" where I specify the help text (as focusPopup needs to be a tiddler title or perhaps more broadly a tw reference (?)). In my case, the reference was "grid##a3" for instance and in grid (a simple dictionary) I had "a3: A3" (just to show what cell you are editing). But when I clicked on the cell, it has the hidden effect to switch "a3: A3" to something like "a3: (42,142,225,24)".

While I'm at it, I cannot see any reference for style like tc-popup-handle in the standard tw docs. Is there a place to look at for them (apart source code and css classes maybe)?

Ads for tool-tips, accessibility rules insists on having some helps for all kinds of inputs. Surely input widgets would be better having a title option (it's simple and quick, event though it may not be sufficient and then popup mechanism already existing would surely bring the solution).

Regards.

Eric Shulman

unread,
Nov 20, 2020, 6:28:54 AM11/20/20
to TiddlyWiki
On Friday, November 20, 2020 at 3:08:36 AM UTC-8 jn.pierr...@gmail.com wrote:
I was about to write I forgot to mention that the $edit-text widget have a focusPopup property, which I have not found out how to use. I saw it apparently required the widget having css class tc-popup-handle. I put my help in focusPopup, but not directly: I use a tiddler name "grid" where I specify the help text (as focusPopup needs to be a tiddler title or perhaps more broadly a tw reference (?)). In my case, the reference was "grid##a3" for instance and in grid (a simple dictionary) I had "a3: A3" (just to show what cell you are editing). But when I clicked on the cell, it has the hidden effect to switch "a3: A3" to something like "a3: (42,142,225,24)".

The focusPopup parameter doesn't specify the *contents* of the desired popup.  Rather, it specifies a "state tiddler" used to control the appearance of a separately-specified popup shown via a $reveal widget.  Thus:

<$edit-text tiddler="foo" class="tc-popup-handle" focusPopup="$:/state/popup/something" />
<$reveal type="popup" state="$:/state/popup/something" class="tc-drop-down">
   this content appears when the edit field has focus
</$reveal>

-e

Jean-Pierre Rivière

unread,
Nov 20, 2020, 7:27:52 AM11/20/20
to TiddlyWiki
Very helpful of both you and it!

The $edit-text widget doc is a bit tiny, lacking in example. This one would clarify it in a definitive manner for a useful feature.

Thanks again.

But what were the numbers (42,142,225,24) meaning in my example? (even though I don't have to know it to use it, it's just that I'm curious.)

Eric Shulman

unread,
Nov 20, 2020, 9:50:18 AM11/20/20
to TiddlyWiki
On Friday, November 20, 2020 at 4:27:52 AM UTC-8 jn.pierr...@gmail.com wrote:
But what were the numbers (42,142,225,24) meaning in my example? (even though I don't have to know it to use it, it's just that I'm curious.)

Those numbers define the rectangle where the popup is displayed: (left,top,width,height) and are automatically generated by the TWCore popup.js code.
(see $:/core/modules/utils/dom/popup.js, and search for popupRect in the Popup.prototype.show function)

-e
Reply all
Reply to author
Forward
0 new messages