Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

md-select: selected option not removed when ngModel updates #2232

Closed
negberts opened this issue Dec 15, 2016 · 5 comments
Closed

md-select: selected option not removed when ngModel updates #2232

negberts opened this issue Dec 15, 2016 · 5 comments

Comments

@negberts
Copy link

negberts commented Dec 15, 2016

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When the options are updated and the selected option is no longer available the selected option should be cleared.
When using enter to open the Md-Select options there should be no error

What is the current behavior?

The selected option is hold on to, although NgModel is null and the options no longer has the selected option available.

After that, when opening the Md-Select options dialog an error occurs: 'unable to get property focus of undefined or null reference'

What are the steps to reproduce?

http://plnkr.co/edit/USEs6VII79YJA7dnh31g?p=preview

Steps:

  1. Choose option 1 on first select: selectedValue1 = 1
  2. Choose option 2 on second select: selectedValue2 = 2
  3. Choose option 2 on first select: selectedValue1 = 2, selectedValue2 = null
  4. Option 2 remains 'selected' on second select

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

Is there anything else we should know?

Callstack:

"TypeError: Unable to get property 'focus' of undefined or null reference
at ListKeyManager.prototype.setFocus (eval code:4573:9)
at MdSelect.prototype._focusCorrectOption (eval code:5106:13)
at MdSelect.prototype._onPanelDone (eval code:5007:13)
at View_MdSelect2.prototype.handleEvent_1 (Function code:459:5)

@negberts
Copy link
Author

Forgot to save the plunker :)

@negberts negberts changed the title md-select: Unable to get property 'focus' of undefined or null reference md-select: selected option not removed when ngModel updates Dec 16, 2016
@crisbeto
Copy link
Member

@negberts I could reproduce it in your Plunkr, but not by running master locally. It might be worth to update to the latest version of Material or to wait for the next release.

@kara
Copy link
Contributor

kara commented Dec 20, 2016

@negberts This looks like a duplicate of #2109. Should have been fixed already in #2110, but it's only in master and hasn't been released yet. I'd check out the new release when it comes out.

@kara kara closed this as completed Dec 20, 2016
@negberts
Copy link
Author

Okay, thank you :)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants