You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Current Behavior:
When a select element is created with both ng-options and ng-model attributes to track the selected option, the "selected" element property is added to the selected attribute (per this issue: #8366). However, when a different option is selected, the "selected" attribute is not removed, resulting in all of the options containing a selected="selected" attribute (if all options have been selected). This is important due to accessibility guidelines stipulate the use of the selected attribute on options to indicate what option has been selected. Aria Guidelines.
Reproduce?
Any select box that has a ng-model tracking the value within an ng-options attribute for a select element. This is a modification of the Angular docs example for ng-options that illustrates nicely the select attribute not being added and removed properly: https://plnkr.co/edit/PjbWbo
Expected behavior?
Only one selected="selected" attributes should be present within the options of a select element. When a selection is changed the attribute should be removed and added to the newly selected option.
What is the motivation / use case for changing the behavior?
As per mentioned above, having one option with a selected attribute allows for proper accessibility functionality.
Versions
This was tested in Angular 1.4.1 and 1.5.3 in Chrome 49, Canary 52, Safari 9 and Firefox 42
I found this was addressed in commits 79538af and 3d393dc