Skip to content

Commit

Permalink
Merge pull request #154 from zapier/fix/focus
Browse files Browse the repository at this point in the history
Fix focus input when mask changes
  • Loading branch information
sanniassin authored Sep 1, 2018
2 parents c2e1a46 + fbbab72 commit 46e78f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"dist/react-input-mask.js": {
"bundled": 38566,
"minified": 13915,
"gzipped": 4878
"bundled": 38610,
"minified": 13929,
"gzipped": 4882
},
"lib/react-input-mask.development.js": {
"bundled": 34353,
"minified": 14960,
"gzipped": 4689
"bundled": 34395,
"minified": 14974,
"gzipped": 4695
}
}
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ class InputElement extends React.Component {

setSelection = (start, end, options = {}) => {
const input = this.getInputDOMNode();
if (!input) {
const isFocused = this.isFocused();
if (!input || !isFocused) {
return;
}

Expand Down

0 comments on commit 46e78f5

Please sign in to comment.