Skip to content

Commit

Permalink
Saving node initial value before focus, so components that clear inpu…
Browse files Browse the repository at this point in the history
…t on focus work
  • Loading branch information
Julius Räihä committed Jul 4, 2018
1 parent 9d2fe4a commit 9b10065
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/change.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ module.exports = function reactTriggerChange(node) {
// Property doesn't exist in React <16, descriptor is undefined.
descriptor = Object.getOwnPropertyDescriptor(node, 'value');

// react-select clears input on focus
if (type !=== 'range') {
initialValue = node.value;
}

// React 0.14: IE9
// React 15: IE9-IE11
// React 16: IE9
Expand All @@ -117,7 +122,6 @@ module.exports = function reactTriggerChange(node) {
if (type === 'range') {
changeRangeValue(node);
} else {
initialValue = node.value;
node.value = initialValue + '#';
deletePropertySafe(node, 'value');
node.value = initialValue;
Expand Down

0 comments on commit 9b10065

Please sign in to comment.