-
Notifications
You must be signed in to change notification settings - Fork 27.4k
No longer setting selected property on <select> elements #8366
Comments
@petebacondarwin I assigned this to you, because you commited the change, is that okay? |
@Narretz - that is fine. I will take a look today |
@JoshSchreuder - This doesn't seem to be related to the commit you suggest. The plunker you provide is acting in the same way for all versions of 1.2.x. The reason is that the options contain numbers but you are setting the model to a string. It may be that there is some other problem that your Plunker is not demonstrating very well. If so please open another issue with a different reproduction. |
@petebacondarwin thanks for having a look. If you click the middle button in your Plunker using the default 1.2.19, the option is selected visibly (which is correct), but the DOM property Now if you swap the Angular version to 1.2.18 (swap the commented out I don't think it's related to what is being set on the model in this case. I tried taking latest 1.2.21 angular.js build, and reversing the specific lines from the mentioned commit in OP. This resulted in |
I see. But if the select value is correct why do you care whether the option is selected? How does that affect your usage? |
@petebacondarwin it's a recommendation in accessibility standards to have a selected attribute on the I was going through accessibility checking my app, and a lack of |
I see, again. I'll take another look today
|
@JoshSchreuder - according to the jquery does, we should be using See http://api.jquery.com/prop/ Can you link to the accessibility requirement that is suggesting otherwise? |
@petebacondarwin I'm using HTML Codesniffer (http://squizlabs.github.io/HTML_CodeSniffer/) which isn't the best way of working out accessibility issues, but the particular guideline it points to is here: Which says that a Additionally, the spec quoted in jQuery docs (http://www.w3.org/TR/html401/interact/forms.html#h-17.6.1) says:
|
OK, so we should ensure that the selected attribute is set when using |
Yep, I think that sounds like a good solution. |
…bute set Using `prop` to set selected is correct programmatically but accessibility guidelines suggest that at least on item should have the `selected` attribute set. Closes angular#8366
Request Type: bug
How to reproduce: Create a
<select>
element. In 1.2.18 this sets the selected attribute correctly, either the first option in the list if the model is clear, or the model value's corresponding<option>
element.In 1.2.19 this does not occur.
Component(s): misc core
Impact: medium
Complexity: small
This issue is related to:
Detailed Description:
Test case here: http://plnkr.co/edit/3zm0K6OK4Dt3DIqZyt06?p=preview
I worked out that the issue exists between 1.2.18 and 1.2.19, specifically this commit: 24aee81
In 1.2.18, Angular sets the
selected
property on the element, whereas in 1.2.19 it does not. Reversing the above commit restores the functionality.It occurs on latest FF, Chrome and IE.
Other Comments:
The text was updated successfully, but these errors were encountered: