Chrome Webix .setValue() 无法始终如一地工作

Chrome Webix .setValue() not working consistently

在 Chrome 上,.setValue("") 并不总是清除可见值。

使用 webix:

webix.ui({
    cols:[
        { view:"text", id:"message", placeholder:"Type chat here..."},
        { view:"button", value: "Send", click:send_message, width:75 }
    ]
});


function send_message(){
    var text = $$("message").getValue();
    if (text)
    {
        //send text to chat
    }
    $$("message").setValue(""); //Should set text field data to blank.
    $$("message").refresh();
    $$("message").focus();
}

在 Firefox 上,当我在键入消息后按 [Enter] 时,send_message 将消息发布到聊天并清除文本字段。在 Chrome 中,文本字段并不总是清除。旧的消息文本在该字段中徘徊。但是,光标会跳到文本的开头。

我不明白为什么 Chrome 会这样。

已找到修复方法。不知道为什么,但是为按钮设置热键解决了这个问题。

 { view:"button", value: "Send", click:send_message, width:75, hotkey:"enter" }

现在,在 Firefox 和 Chrome 中按回车键和单击按钮一样有效。