-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs(guide/Internet Explorer Compatibility): Include warnings for usage of 'disabled' attribute #16490
Conversation
…bute Setting the 'disabled' attribute on an element that has descendant elements has unexpected behavior in Internet Explorer 11. * Input elements that are descendants have the text content of the 'placeholder' attribute inserted as the value (and it is not removed when typing in the field). * Select elements that are descendants are disabled. To avoid this issue, it is important to not set `disabled` or `ng-disabled` on an element that has descendant form elements. Normally these should only be used on actual form controls so the issue would not manifest. The issue can also appear if a directive/component is named 'disabled' or takes an attribute named 'disabled' as an input/output attribute, so avoid these.
Hm, I'm on the fence about this one because while it affects IE it's not very specific to AngularJS and it's also very rare to set disabled attribute on a non-interactive element. Compare that to placeholder which is very likely to get interpolated. |
1 similar comment
Hm, I'm on the fence about this one because while it affects IE it's not very specific to AngularJS and it's also very rare to set disabled attribute on a non-interactive element. Compare that to placeholder which is very likely to get interpolated. |
I'm inclined to agree with you that setting of However, I think it is within the scope of the document to mention the potential issue of using the name
Perhaps I could modify my doc change to only mention the problem in the context of custom tags/attributes. That way, the information on the IE-specific behavior is tracked and someone with a related issue regarding unconventional use of |
Ok, if you stress that this will usually happen in context of custom directives / components, then I'll add it. Please also mention that the workaround is to use a different attribute than 'disabled'. |
* Rewrote description to emphasize the bug in the context of custom directives. * Mention workaround of not using the name `disabled` for custom directive attributes or attributes passed to a custom directive.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
1 similar comment
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
Thanks @gscoppino |
I'm fine with the changes. Thanks! |
…ge of 'disabled' attribute * docs(guide/Internet Explorer Compatibility): Mention 'disabled' attribute Setting the 'disabled' attribute on an element that has descendant elements has unexpected behavior in Internet Explorer 11. * Input elements that are descendants have the text content of the 'placeholder' attribute inserted as the value (and it is not removed when typing in the field). * Select elements that are descendants are disabled. To avoid this issue, it is important to not set `disabled` or `ng-disabled` on an element that has descendant form elements. Normally these should only be used on actual form controls so the issue would not manifest. The issue can also appear if a directive/component is named 'disabled' or takes an attribute named 'disabled' as an input/output attribute, so avoid these. Closes #16490 Related #15700
Setting the 'disabled' attribute on an element that has descendant elements has unexpected behavior in Internet Explorer 11.
To avoid this issue, it is important to not set
disabled
orng-disabled
on an element that has descendant form elements. Normally these should only be used on actual form controls so the issue would not manifest.The issue can also appear if a directive/component is named 'disabled' or takes an attribute named 'disabled' as an input/output attribute, so avoid these.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Docs update
What is the current behavior? (You can also link to an open issue here)
Docs do not mention IE11 bug regarding the disabled attribute on elements with descendants (though it shouldn't be used on non-form controls, this issue can prop up when making custom elements/attributes).
A previous issue noticed the incorrect behavior regarding the 'placeholder' attribute on input elements but incorrectly thought the behavior to be a bug with AngularJS:
#15700
I am able to reproduce the issue in the Plunkr created by @Narretz on the aforementioned issue:
http://plnkr.co/edit/jDJv5NtwwDSsp9hRT2rf?p=preview
Also, here's an updated version of the Plunkr showing model value is not updating due to the 'disabled' attribute:
http://plnkr.co/edit/AHix3x3dOzySygDOcfJA?p=preview
What is the new behavior (if this is a feature change)?
Docs mention the bug and suggest preventative measures.
Does this PR introduce a breaking change?
No.
Please check if the PR fulfills these requirements
Other information: