-
-
Notifications
You must be signed in to change notification settings - Fork 926
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
Fixing IE bug causing active element to be null causing render function to error #1943
Fixing IE bug causing active element to be null causing render function to error #1943
Conversation
@JacksonJN thanks for the report/PR, are you sure that it is always Also, updating the mocks for having
|
@pygy I am pretty sure it is only if (active && $doc.activeElement !== active) active.focus() Also I have added an inline comment about the bug. |
@JacksonJN thanks :-) A weak |
@pygy Done. Also I just realized this should probably be released with 1.1.4 and not 2.0.0. Should I change the merge-to-branch to v1_1_x? |
@JacksonJN LGTM Regarding the branch, I must admit I have little experience with gitflow-like setups and I don't know if one is preferable to the other... We'll have to cherry pick the fix to the other branch anyway... @tivac @isiahmeadows @lhorie any preference here (and in general)? |
I'd target the change to There isn't a good answer for this flow that I'm aware of unless we want to try doing rebasing, which seems likely to end in failure/disappointment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 👍
@pygy I don't care what we choose to do as long as it's not too complicated and it generally works. I've been time-limited lately, so it's not likely to affect me much. |
@tivac I'd rather merge this into |
4965aa9
to
5303e70
Compare
I rebased and fixed merge conflicts. Is this ready to merge? |
@pygy Ready for v1 backport! |
Description
There is an issue in IE where
document.activeElement
becomes null sometimes. For example when you useremoveChild
to remove an element, the active element isn't reset. And sometimes in iframes.When this happens using mithril, the render function throws an error on line 633.
This is an issue that has come up in other frameworks, for example in Angular.
Motivation and Context
In my case, I have a click event that removes an element that has an
onremove
function. Thatonremove
function usesremoveChild
to remove the dom element. The same click event creates an element that runs.focus()
inside aoncreate
function. This causes the if statement on line 633 to pass andactive.focus()
to run, during which an error is caused byactive
being null.How Has This Been Tested?
Confirmed this does not break any tests and does not cause any lint errors. I'm not sure what a new test would look like since
activeElement
can't be set.Types of changes
Checklist:
docs/change-log.md