@samitouri / QOS-React-2 / commits / 6203e53d16

Fix IE8 disabled input throwing on focus

When IE8 focuses a disabled item, it throws This makes sure the we're not focusing the item during selection restoration/autofocus when the element's disabled.

Cheng Lou committed Mar 3, 2014 at 09:36 UTC 6203e53d16be80db5661f5bd51947fec0dc083fb
2 files changed +5 -2
src/browser/ReactInputSelection.js
+2 -1
@@ -21,6 +21,7 @@
21 var ReactDOMSelection = require('ReactDOMSelection');
22
23 var containsNode = require('containsNode');
24 +var focusNode = require('focusNode');
25 var getActiveElement = require('getActiveElement');
26
27 function isInDocument(node) {
@@ -71,7 +72,7 @@ var ReactInputSelection = {
72 priorSelectionRange
73 );
74 }
74 - priorFocusedElem.focus();
75 + focusNode(priorFocusedElem);
76 }
77 },
78
src/browser/dom/components/AutoFocusMixin.js
+3 -1
@@ -19,10 +19,12 @@
19
20 "use strict";
21
22 +var focusNode = require('focusNode');
23 +
24 var AutoFocusMixin = {
25 componentDidMount: function() {
26 if (this.props.autoFocus) {
25 - this.getDOMNode().focus();
27 + focusNode(this.getDOMNode());
28 }
29 }
30 };