Preface:I'm fairly experienced with TWC and I'm just now beginning to fool around with TW5. TWC was fairly straightforward: If you wanted to modify the underlying UI and/or functionality of the wiki, you create a macro and use JavaScript together with the built-in TW functions like "createTiddlyButton" to build the elements you want to dynamically insert. In comparison, TW5's system of widgets, macros, variables, transclusion-heavy tiddlers, etc. was a bit overwhelming at first but I'm beginning to get a handle on it... or so I thought.
Issue:I want to make it so I can press Enter to add a tag instead having to click the "Add" button every time. The
KeyboardWidget seemed built specifically for this purpose.
I edited
$:/core/ui/EditTemplate/tags and surrounded the "add tag" $edit-text widget with my $keyboard widget like so:
<$keyboard message="tm-add-tag" param={{$:/temp/NewTagName}} key="enter">
<$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify "$:/state/popup/tags-auto-complete">> class="tc-edit-texteditor tc-popup-handle"/>
</$keyboard>
The good news is, when I press Enter, it now adds whatever text is in the "add tag" field to the tag list. The bad news is, as I'm typing, after every keypress the "add tag" field loses focus, essentially making typing impossible.
This seems like a fairly simple use case but perhaps I'm missing something. Am I making a mistake or is this a known issues with
KeyboardWidget? Without visibility into the underlying JavaScript behind the widget itself, it's difficult to diagnose.