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

Commit 42c97c5

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 e1f4f23 commit 42c97c5

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
@@ -576,11 +576,16 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
576576
function updateOptionElement(option, element) {
577577
option.element = element;
578578
element.disabled = option.disabled;
579-
if (option.value !== element.value) element.value = option.selectValue;
579+
// NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive
580+
// selects in certain circumstances when multiple selects are next to each other and display
581+
// the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
582+
// See https://github.com/angular/angular.js/issues/11314 for more info.
583+
// This is unfortunately untestable with unit / e2e tests
580584
if (option.label !== element.label) {
581585
element.label = option.label;
582586
element.textContent = option.label;
583587
}
588+
if (option.value !== element.value) element.value = option.selectValue;
584589
}
585590

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

0 commit comments

Comments
 (0)