TabView automatic focus

In Webix version before 4 (3.x) it was possible to set datatable focus automatically when tabview which contained that datatable was clicked on.
Now it seems that with new keyboard tabbing functionality when I click on the tab, it is no longer possible to automatically set focus on the table. Instead when I click on the tab, and then use arrow-keys on keyboard, I can choose between next/previous tab.

Sample snippet, which uses webix.UIManager.setFocus, and which worked previously, is here: http://webix.com/snippet/b73b0d1a

Please advise how to accomplish this automatic datable focus on tab activation?

var ntv2 = $$(“tabview1”).addView({

})

$$(ntv2).show();

my way of adding and focusing to last:

var $tabID = '$tab' + webix.uid();
var $tab = { header: {...}, body: { id: $tabID, ... }};
$$('tabview').addView($tab);
$$('tabview').setValue($tabID);

before version 4 it was much easier, but after update I did not find other way

Sophie’s method is possible too, but if not set body’s id explicitly, tab header is not focused. looks like a bug.

http://webix.com/snippet/3837b729 if body id is NOT a string, tab header is not focused

Actually, my problem is not view addition, but automatic view focus on tab activation.

Previously (ver 3.x) I was able to set focus on the table (using webix.UIManager.setFocus) after user clicked on the tab (using onViewShow event) that contained the datatable.

This meant, that user was able to use keyboard (e.g. arrow keys) on the table right after activating the tab. Now it is no longer possible and user has to make 2 clicks: first to activate the tab and second to activate the table inside that tab.

If the datatable is not activated explicitly after clicking on the tab, then arrow-keys are navigating to previous/next tab, which doesn’t seem very intuitive, as I don’t think someone clicking on the tab really wants to start moving between tabs with arrow-keys.

try to use setTimeout

http://webix.com/snippet/1a81f927

setTimeout() hack seems to be working at the moment, but is it really how it’s supposed to work?

Unfortunately, there is no to avoid the timeout usage, it is necessary to avoid a conflict with native on-click focusing behavior.

You can replace timeout with webix.delay ( which do nearly the same), and use a single code for all tabs, though.

http://webix.com/snippet/a76ab2c7