-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX release-1-13] Make type attr on inputs immutable for IE8 #12351
Conversation
👍 I was able to build and run in IE 8 using the VM's on https://dev.modern.ie/tools/vms/windows/. I was however, not able to run the tests in IE 8 due to various exceptions. @rwjblue is the test suite for 1.13.x supposed to run on IE 8? |
I can confirm that this fixes the IE8 input incompatibility. |
Any word on when a bugfix release will happen with this fix in it? I've got some pretty ugly hacks in place trying to workaround all components that use {{input}} and they aren't working too well. |
👍 great work! Thanks @xcskier56 for taking the time to fix this, can't wait to see it in the next release. |
Bump. Will the next release include this bugfix? Any ETA on it? Thanks in advance. |
// IE8 Support: IE8 cannot change the type attr of an input after it has been appended to | ||
// any node. Therefore, we detect if the browser cannot change the type of the input after | ||
// being appended, and unbind type. | ||
if (normalized.type && !canChangeType) { |
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.
This seems more complicated than I would have assumed.
I was thinking something like:
if (attrs.type && !canChangeType) {
attrs.type = getValue(attrs.type); // forces a static value
}
Done around here would do the trick.
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.
The simpler version works but you don't get warnings. The warnings are a nice feature.
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.
Simpler is much less likely to cause other issues down the line. We should ensure that a deprecation is printed when you use IE8 (I vaguely think that there is already), and remove the extra complication here.
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.
The simple version does not address #12295. For the case where the component definition defines the type attribute instead of the template we need to compute the property value.
@rwhblue, thanks for the feedback. I will get to work on this. Is there an estimated date for the next release that this could make it into? |
I do not have a specific timeline for the next release. This seems to be a big enough fix to justify a releas shortly after landing, Also, remember that you can use the latests builds from |
@xcskier56 Any progress on the changes? I can help were needed. |
I opened xcskier56#1 to clean up this PR slightly. |
Does anyone know if the code in |
Only compute mutable type flag once and clean up var initilization.
@gauthierm, thanks for the help in finishing up the PR. Looking forward to landing this. |
@xcskier56 Thanks for working on this issue. I'm eager to see this merged. Does @gauthierm's change address all of the concerns that @rwjblue had? Let me know if I can help in any way. |
ping @xcskier56 (wrong autocomplete in #12351 (comment)) |
Thanks @xcambar - sorry for the noise. |
@rwjblue do you have time to look at this PR again? |
Is there anything more we as the community can do to help get this merged? #12351 (comment) says to bower install from release-1-13 but if I'm not mistaken this PR has to be merged before it's on that branch :) |
@jerel It's not merged so using the latest build won't include the bug fix. You'll have to:
I've done all that at https://github.com/silverorange/ember/tree/1.13.10-so.1. You can fork off that if you want. I do not recommend using it directly in your bower config as it may disappear after this PR is merged. |
Has anyone else explicitly tested a radio button with this patch? Inputs don't cause IE8 to crash now but I'm still seeing a text input like is reported in #12295 with <input name="foo" class="ember-view ember-text-field" id="ember644" type="radio" value="false"/>` and it shows up as a text input. And @gauthierm, thanks so much for sharing that release. |
@jerel I have not tried a radio input. I've only used "email" and "text". |
@jerel I've tried this PR with radio inputs in IE8 on Windows XP and it works fine. |
@gauthierm, this is the situation where I was hoping the You can see it here around line 274 |
@xcskier56 I think it can be handled as part of this PR. I have a fix for #12295 which I'll submit a PR for in a sec. |
@gauthierm I just rechecked here and the built in helper |
@xcskier56 @jerel xcskier56#2 should fix default type attribute values on custom components. |
|
||
function canChangeTypeAfterRender(attrs) { | ||
// This permits testing of the unbound type attr behavior outside of IE8. | ||
if (attrs.ie8SafeInput) { |
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.
A [BUGFIX release] should not add new API. I would be fine with either prevent any changing of type after initial render (this was asserted in some versions of Ember prior to 1.13 anyways) or simply ignoring and deferring the testing to applications if they need to confirm things work...
I left a couple more comments. If someone can address them (either by updating this PR or pulling these commits into another), we can try to finally get this dealt with. Sorry for the delays here. |
Which code specifically? The entire file is certainly not obsolete (it is what defines the component used by |
https://github.com/emberjs/ember.js/blob/release-1-13/packages/ember-views/lib/views/text_field.js#L13-L35 and associated code. It looks like it's doing some extra checking of whether the type attribute can be bound. |
Merged in under #12596. |
This fixes #11553 and #12295 as well as tildeio/htmlbars#380. This works by detecting if the browser can change the type attr on an input after it has been appended to a node, and then if it cannot, unbinding the type attr so that it is set on the input immediately before being appended to a node.