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

fix(select): placeholder (empty option) is lost in IE9 #2188

Closed

Conversation

henrikhulgaard
Copy link

Fixes a check inside render for select elements with ngOptions, which compares the selected property of an element with it's desired state.
Ensured the placeholder, if available, is explicitly selected if the model value can not be found in the option list.
Without these fixes it's up to the browser implementation to decide which option to choose.
In most browsers, this has the effect of displaying the first item in the list. In IE9 however, this causes the select to display nothing.

Closes #2150, #1826

Fixes a check inside render for select elements with ngOptions, which compares the selected property of an element with it's desired state.
Ensured the placeholder, if available, is explicitly selected if the model value can not be found in the option list.
Without these fixes it's up to the browser implementation to decide which option to choose.
In most browsers, this has the effect of displaying the first item in the list. In IE9 however, this causes the select to display nothing.

Closes angular#2150, angular#1826
@ghost
Copy link

ghost commented Mar 20, 2013

This is a commencement of the previous pull request #2165.

It became clear after some further testing that the key misunderstanding was that the check on line 471 ( configit@848944b#L0L471) was looking for a dom property on a jquery element and was thus always undefined.

The previous pull request caused a problem when trying to clear the select via the ngModel, which wasn't caught by any unit test; one is now provided to avoid this scenario.

In addition to addressing that in this pull request, the logic for deciding if the blank option or the null option should be chosen has been moved closer together and rectified to ensure that option is correctly, explicitly set on all platforms.

@just-boris
Copy link
Contributor

+1.
It helped me to fix a bug in my project

@petebacondarwin
Copy link
Contributor

  • Contributor signed CLA now or in the past (if you just signed, leave a comment here with your real name)
  • PR doesn't introduce new api
  • PR doesn't contain a breaking change
  • PR contains unit tests
  • PR contains e2e tests (if suitable)
  • PR contains documentation update (if suitable)
  • PR passes all tests on Travis (sanity)
  • PR passes all tests on ci.angularjs.org (cross-browser compatibility)
  • PR is rebased against recent master
  • PR is squashed into one commit per logical change
  • PR's commit messages are descriptive and allows us to autogenerate release notes (required commit message format)
  • All changes requested in review have been implemented

@petebacondarwin
Copy link
Contributor

LGTM - the test fails without the fix on IE9 and the fixed code passes all tests on the ci server.

@petebacondarwin
Copy link
Contributor

Landed at: 4622af3

@petebacondarwin
Copy link
Contributor

@chad-configit - Can you please ensure that you sign the CLA, otherwise we may have to revert this fix.
Thanks

@henrikhulgaard
Copy link
Author

@petebacondarwin - As noted on pull request #2165: The CLA has been signed and submitted to [email protected] on Mon, Mar 4, 2013 at 2:50 PM.

@petebacondarwin
Copy link
Contributor

@henrikhulgaard - that appears only to be for you but not Chad.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The placeholder (null option) in an ngSelect is broken in certain scenarios on IE9
3 participants