mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix IE8 potentially throwing during restoreSelection
This commit is contained in:
Vendored
+5
-4
@@ -19,14 +19,15 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* IE8 throws if an input/textarea is disabled and we try to focus it.
|
||||
* Focus only when necessary.
|
||||
*
|
||||
* @param {DOMElement} node input/textarea to focus
|
||||
*/
|
||||
function focusNode(node) {
|
||||
if (!node.disabled) {
|
||||
// IE8 can throw "Can't move focus to the control because it is invisible,
|
||||
// not enabled, or of a type that does not accept the focus." for all kinds of
|
||||
// reasons that are too expensive and fragile to test.
|
||||
try {
|
||||
node.focus();
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user