It’s the focus piece that doesn’t work. If I do it again the focus works (after already on the right tab). So it’s not broken code, just not running sequentially? I thought the issue would be solved by modifying it per https://tiddlywiki.com/#ActionWidget%20Execution%20Modes using
The issue you are encountering is one that frustrates me often but there isn’t always a good solution for. The input field that you want to focus does not yet exist at the time that the tm-focus-selector message is handled. What is needed in these kinds of situations is to delay some actions until after the refresh cycle has completed, and short of some custom widgets I have not found a generalized solution for this.
In this particular situation, might you be able to set the input field to auto capture focus? That would give it focus as soon as the containing tab is activated.