Do you want to request a feature or report a bug?
Bug
What is the current behavior?
We have an onClick handler on an SVG element. The handler sets a state property that causes the element to be hidden (via CSS). This makes IE11 throw on this line:
https://github.com/facebook/react/blob/52eb59dda2eb0d9afe3a18aacd6142c1d2f7ee25/packages/react-dom/src/client/ReactInputSelection.js#L72
It seems that #11800 removed a try/catch protection for this.
I am working around the problem by stubbing focus like this:
if (typeof SVGElement.prototype.focus === 'undefined') { SVGElement.prototype.focus = function () {}; }
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Worked in 16.2.2
Can you put together a reproduction demonstrating the issue?
In the meantime please feel free to send a PR adding try-catch with an explanation comment
I hava a same problem.
React 16.4
@ThaddeusJiang That doesn't help us in any way. It will help us if you provide a reproducing case. Thanks.
Can somebody with IE11 figure out if:
focus() in IE11focus() call throws on hidden elementsSorry, I forgot about this because my workaround solved it for me. I will make a PR and try to figure out if it applies to other classes as well
Thanks!
@gaearon
when user drags a Element, 'focus' is not supported Exception be thrown
Environment



OK. Somebody want to send a PR that reverts https://github.com/facebook/react/pull/11800?
Yes, I do.
Fixed in React 16.4.1.