From daba67692eb85985c4d86900ed7c56e18caa3db7 Mon Sep 17 00:00:00 2001 From: Garth Williams Date: Mon, 15 Feb 2016 16:32:17 +0100 Subject: [PATCH] Fix cursor jumping to the end of "controlled" inputs DOM `INPUT.value` should never be updated when it matches the new vnode. This fixes issues where typing into an INPUT with a sync event handler cause a render (such as for validation feedback) where setting `INPUT.value` also pushes the cursor to the end of the input. --- modules/props.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/props.js b/modules/props.js index 70795ab..84ed631 100644 --- a/modules/props.js +++ b/modules/props.js @@ -9,7 +9,7 @@ function updateProps(oldVnode, vnode) { for (key in props) { cur = props[key]; old = oldProps[key]; - if (old !== cur) { + if (old !== cur && (key !== 'value' || elm[key] !== cur)) { elm[key] = cur; } }