Unable to focus into text box for enter button

Hi,
I have a problem with enter button for text.Here is a scenario like, I enter a text and press enter button, the coursor is not focus into that text area. But for second press it is focusing. It is happening simultaneously.
Please find below snippet.

{
                                        view: "form",
                                        scroll: false,
                                        height: 65,
                                        css: "itemview-footer comments",
                                        cols: [{
                                            view: "text",
                                            id: "commentArea",
                                            css: "single-column",
                                            placeholder: "Write a comment",
                                            label: "Comments",
                                            focus: true,
                                            labelPosition: "top",
                                            labelWidth: 200
                                        }, {
                                            view: "button",
                                            value: "Share",
                                            id: "Share",
                                            hotkey: "enter",
                                            css: "save share"
                                        }]
                                    }

$$('Share').attachEvent("onItemClick", function() {
                                    var commentMsg = $$("commentArea").getValue().toLowerCase();
$$("comments").parse(typedComments);
$$("commentArea").$setValue("");
                                    $$("commentArea").focus();
});

Thanks in advance.

As quick solution try to change the last line like next

webix.delay(function(){ $$("commentArea").focus(); });

Most probably onItemClick fire before native “enter” key processing, and after moving focus to “commentArea” it jumps back because of native action processing.

Thanks maksim…It is working good. And I have one more issue in this, i.e., Initially that commentArea is not focusing even I put “focus: true”.

Please share a snippet or a demo link as I can’t reconstruct the same issue locally.

http://webix.com/snippet/4d203605