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

Handle the onChange event on ngOptions is insufficient #10233

Closed
paulsouche opened this issue Nov 26, 2014 · 5 comments
Closed

Handle the onChange event on ngOptions is insufficient #10233

paulsouche opened this issue Nov 26, 2014 · 5 comments

Comments

@paulsouche
Copy link

According to this script the ng-options directive handle the onChange event to set the ngModel up to date.

That's insufficient in case of keyBoard navigation on select because this event is not trigerred (on Firefox for example)

A solution is to add the keyup event into the loop...

Thanks

@pkozlowski-opensource
Copy link
Member

@paulsouche just to clarify - are you referring to the fact that the change event is not fired till a <select> loses focus? http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents

@pkozlowski-opensource
Copy link
Member

Apparently it was brought up before:

But all those issues are closed now and it is not clear if we want to "correct" browser's behaviour here. @paulsouche are you seeing this with FFox only (version?) or other browsers as well?

@paulsouche
Copy link
Author

Indeed on firefox the onChange event is triggered when the select loses focus and that sufficient for me. But on Chrome you can reproduce my bug with this fiddle.

Story :
click on the body
hit tab to focus the first select
hit the down arrow 2 times --> the model is not updated on second time but the view is
hit tab to focus the second select --> no onchange event is fired on blur

I'm ok with the other issues : that's not an angular bug but a browser one. But I'm just asking could we fix it ? and the best way ?

By the way IE seems to manage it right.

Thanks

@gkalpak
Copy link
Member

gkalpak commented Nov 27, 2014

Basically, this is a (tricky to reproduce) browser bug (related to removing an <option> element at runtime).

Similar issues have been reported: #4836, #7042, #7544, #9134 (probably more)

And a bug has been filed: https://code.google.com/p/chromium/issues/detail?id=415505

@paulsouche
Copy link
Author

Ok indeed manage the empty option in the model fix the bug.

That fits to me. Thank you.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants