[英]React/Redux: focus is lost in the input field
When you enter text in the field, focus is lost.在字段中输入文本时,焦点会丢失。 Why?
为什么?
If remove the label prop, then the problem is solved.如果去掉标签道具,那么问题就解决了。 But a label is needed
但是需要一个标签
<SimpleItem
label={{ text: "Your Address" }}
dataField="surname"
editorOptions={{
value: formEdit.surname,
onValueChanged: ({ value }) => {
addChange("surname", value);
},
valueChangeEvent: "keyup"
}}
/>;
online demo: https://codesandbox.io/s/de-form-ezmmg在线演示: https : //codesandbox.io/s/de-form-ezmmg
I noticed that when using Label
as child of SimpleItem
(instead of prop), the input doesn't lose focus on keyup event (I tried digging in the docs, but I couldn't find a reason why this would happen):我注意到当使用
Label
作为SimpleItem
子SimpleItem
(而不是 prop)时,输入不会失去对 keyup 事件的关注(我尝试在文档中进行挖掘,但我找不到会发生这种情况的原因):
<SimpleItem
dataField="surname"
editorOptions={{
value: formEdit.surname,
onValueChanged: ({ value }) => {
addChange("surname", value);
},
valueChangeEvent: "keyup"
}}
>
<Label text="Your Address" />
</SimpleItem>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.