Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit dbc6985

Browse files
committed
fix(ngOptions): prevent frozen select ui in IE
In certain scenarios, IE10/11/Edge create unresponsive select elements. The following contribute to the bug: - There need to be at least 2 selects next to each other - The option elements are added via javascript - the option.value is accessed before it is set - the option.label is added after the option.value has been set - The first select is wrappend in an element with display: inline or display: inline-block, This cannot be tested in a unit-test or e2e test. Closes #11314 Closes #11795
1 parent a7f3761 commit dbc6985

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/ng/directive/ngOptions.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,16 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
579579
function updateOptionElement(option, element) {
580580
option.element = element;
581581
element.disabled = option.disabled;
582-
if (option.value !== element.value) element.value = option.selectValue;
582+
// NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive
583+
// selects in certain circumstances when multiple selects are next to each other and display
584+
// the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
585+
// See https://github.com/angular/angular.js/issues/11314 for more info.
586+
// This is unfortunately untestable with unit / e2e tests
583587
if (option.label !== element.label) {
584588
element.label = option.label;
585589
element.textContent = option.label;
586590
}
591+
if (option.value !== element.value) element.value = option.selectValue;
587592
}
588593

589594
function addOrReuseElement(parent, current, type, templateElement) {

0 commit comments

Comments
 (0)