Skip to content

priorFocusedElem.focus() throws in IE11 #12763

@kristiandupont

Description

@kristiandupont

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:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions