Assigning focus to a control should be possible when it is rooted in DOM.
However, due to DesignMode's async. initialization, this does not work:
var ed = new Fit.Controls.Input();
ed.DesignMode(true);
ed.Render(document.body);
ed.Focused(true); // Focus must be set AFTER control has been rooted in DOM
The example above does not work - the control does not gain focus. It works as expected for a traditional textarea control:
var ed = new Fit.Controls.Input();
ed.MultiLine(true);
ed.Render(document.body);
ed.Focused(true); // Focus must be set AFTER control has been rooted in DOM
The browser/document must have focus for this to work, naturally.
If the issue is resolved by postponing focused state until editor is ready, then consider whether execution of OnFocus should be async. as well. This behavior will differ from all other components where OnFocus fires immediately when calling Focused(true).
EDIT: Actually OnFocus fires async. since it is based on FocusIn. But it fires almost immediately.
The best solution is probably to have the control container gain focus temporarily and fire OnFocus immediately. This will also allow for OnBlur to fire as expected if control lose focus again while editor is loading.
Assigning focus to a control should be possible when it is rooted in DOM. However, due to DesignMode's async. initialization, this does not work:
The example above does not work - the control does not gain focus. It works as expected for a traditional textarea control:
The browser/document must have focus for this to work, naturally.
If the issue is resolved by postponing focused state until editor is ready, then consider whether execution of OnFocus should be async. as well.
This behavior will differ from all other components where OnFocus fires immediately when calling Focused(true). EDIT: Actually OnFocus fires async. since it is based on FocusIn. But it fires almost immediately. The best solution is probably to have the control container gain focus temporarily and fire OnFocus immediately. This will also allow for OnBlur to fire as expected if control lose focus again while editor is loading.