Hi,
So - for a TiddlyWiki (five, of course) that I'm using for a personal project, I am attempting to set up something that superficially resembles a relational database (except not in the backend, of course - I don't expect the data to grow large enough for the performance issues to matter). I want there to be a whole family of tags each of which, when present, indicates that there should be a specific collection of field editors, comprising a form, at the top of the tiddler. I've got this mostly working:
<$cond p="[tag[Ability]]"><h2>Ability Details</h2>
<$edit-text field="data/Ability/inputs" class="tw-edit-texteditor" tag="textarea"/>
<h3>Expected Outputs</h3>
<$edit-text field="data/Ability/outputs" class="tw-edit-texteditor" tag="textarea"/>
<h3>Expected ~Side-Effects</h3>
<$edit-text field="data/Ability/side-effects" class="tw-edit-texteditor" tag="textarea"/>
... As an example of one such form; the above is the source text of a tiddler which is indirectly included in the edit template. (That $cond is a macro of my own authorship, but you can see what it's doing. I'd have contributed it, but I feel as though using the filter mechanism for arbitrary predicates is rather messy, and would rather have a better approach...) There's a similar one for view, which works perfectly, but it's edit that I'm having trouble with...
It uses the $edit-text macro to insert widgets for each of three side-channel fields in the tiddler being edited. They appear to correctly display the values of those fields, and to be updated appropriately as those values change. The problem I'm having is that typing any input character (text only - arrow keys and other movement shortcuts work fine) causes the input field to lose focus and the page to scroll down to the "fields" section of the edit display, below.
I assume that this has something to do with the events mechanism, but I'm a little lost in the code... I looked at the source of $:/core/modules/widgets/edit-text.js, and noted that it has some events stuff and some scroll stuff, which I assume are scoped too broadly, causing the misbehavior I'm encountering. But I'm at a loss for where those events are dispatched from, or what their scoping ought to be. I can't find the code that implements the event-dispatch mechanism, either.
Any advice would be appreciated. :)
Irene