Make sure inputs don't lose focus

selectionStart/End should not be set on inputs that don't have focus
currently.
This commit is contained in:
Dan Holmsand 2015-08-19 10:50:53 +02:00
parent 6548e7ef76
commit 5bbba3e30a
1 changed files with 2 additions and 1 deletions

View File

@ -105,7 +105,8 @@
(let [node (.' this getDOMNode)
node-value (.' node :value)]
(when (not= value node-value)
(if-not (has-selection-api? (.' node :type))
(if-not (and (identical? node (.-activeElement js/document))
(has-selection-api? (.' node :type)))
; just set the value, no need to worry about a cursor
(.! node :value value)