felixhayashi / TW5-TiddlyMap

Map drawing and topic visualization for your wiki

Home Page:http://tiddlymap.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Edge dialog doesn't focus on edit-text anymore

flibbles opened this issue · comments

In TiddlyWiki v5.1.23, when you click-dragged a new edge, the popup would have the edit-box already focused. As it should, since it has the focus="yes" attribute.

But it doesn't work anymore, which introduces the following steps into my workflow

  1. move hand to mouse
  2. move pointer to text box
  3. click
  4. move hand to keyboard

This is bullshit.

I've tried tracking this down. Tiddlywiki has pushed a change (Jermolene/TiddlyWiki5#5736). This reduces the cases when $transclude widget needs to refresh. This broke it. I stepped through the code to figure out why.

Apparently, the order of operations was: create dialog tiddler, render, attach DOM object to document.body, then slide into view. BUT THEN a "change" event would go through which would cause the dialog to rerender (because the transclude widget in gui/dialog/dialog.tid would refresh. Technically, this refresh should be superfluous since the dialog is already made, but it wasn't. That refresh is what caused the focus to work. Now that the transclude realizes it doesn't need to refresh, it doesn't work anymore.

Even though node.focus is called on that edit-text when it's created, it doesn't take. I think it's because the dialog isn't attached to document.body yet, but when I shuffle things around, it still doesn't work. I'm hoping you might have a better idea.

Either way, I've created a workaround which I'll push in a second. It's not the solution TiddlyMap needs, but it's a solution that works.