-
-
Notifications
You must be signed in to change notification settings - Fork 927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IE11: when document.activeElement is not an HTML element, the rendering fails #1983
Comments
@mpfau thanks for the report. I suppose we should strive for homogenous behavior and implement your suggestion, though my fingers are burning to use |
I'm coming up against this. Mithril 1.1.6 on IE11. |
sebastiansandqvist
added a commit
to sebastiansandqvist/mithril.js
that referenced
this issue
Jun 11, 2018
11 tasks
pygy
pushed a commit
that referenced
this issue
Jun 11, 2018
dead-claudia
pushed a commit
to dead-claudia/mithril.js
that referenced
this issue
Oct 12, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In case document.activeElement is not an HTML element (e.g. an SVG), the fix from #1943 still fails as focus can only be called on an HTML element.
Expected Behavior
No error occurs, the rendering should complete and document.activeElement should not be modified by mithril when it is no HTML element
Current Behavior
mithril invokes document.activeElement.focus() no matter if the element is an HTML element. The following error is thrown and the rendering is aborted:
TypeError: Object doesn't support property or method 'focus'
Possible Solution
Change https://github.com/MithrilJS/mithril.js/blob/next/render/render.js#L647 to:
if (active != null && $doc.activeElement !== active && active instanceof HTMLElement) active.focus()
Steps to Reproduce (for bugs)
Click on an svg that triggers document.activeElement = svg
Your Environment
The text was updated successfully, but these errors were encountered: