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

select changes value when typing into nearby text input #2230

Closed
stephenhuey opened this issue Mar 26, 2013 · 10 comments
Closed

select changes value when typing into nearby text input #2230

stephenhuey opened this issue Mar 26, 2013 · 10 comments

Comments

@stephenhuey
Copy link

This bug is occurring in Chrome (Version 25.0.1364.172) but not in Firefox or Safari. I mentioned it on the Google Group here:

https://groups.google.com/d/msg/angular/4dlx_OSY8uQ/l2prTdNpOEcJ

Here is a simple demo of the problem:

http://jsfiddle.net/ADukg/2148/

My model person has a person.name, a person.state, and a person.phone. I enter a name in the first text input, tab to the state select and hit the letter T twice (choosing TN first and ultimately stopping on TX) and then tab to the next text input, and as I'm typing in the phone number the select mysteriously changes to TN.

Is this a bug in Angular or Chrome? As I said, it's not doing this in Safari or Firefox.

@mernen
Copy link
Contributor

mernen commented Apr 22, 2013

According to my observations, this is a bug in Chrome, triggered by Angular's removal of the blank item during the first first selection (change event). This causes the second selection to never trigger another event.

Since the cause is the dynamic removal of an option, one possible workaround for you would be to have the empty option always available, with an explicit <option value="">…</option>.

I'll report this on Chrome's bug tracker with a simpler test case later.

@trea
Copy link

trea commented May 11, 2013

@mernen Do you have a link to that Chrome bug report by chance? I'd love to keep tabs on that one.

Thanks!

@btford btford closed this as completed Aug 24, 2013
@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

@kmccullough
Copy link
Contributor

I have also encountered this issue using angular version 1.2.14 and Chrome version 33.0.1750.149 on Ubuntu 12.04. I can confirm that @mernen's suggestion of adding an explicit empty option fixes this issue for me.

@RodolpheGohard
Copy link

the bug still happens with both 1.2.0 and 1.2.16 on Chrome Version 33.0.1750.152 when you do not force an empty option:

check here: http://plnkr.co/edit/2R9YM6KF01bye4kPeoZL?p=preview

EDIT: the bug demonstrated here looks more like #4216 . but the fix described in this issue works, it seems indeed related to the removal on the blank item.

@bramslob
Copy link

bramslob commented Apr 8, 2014

@Biaib Using the 1.3 beta instead of 1.0.5, in Chrome 33.0.1750.154, i can confirm it is fixed. I have an updated version of the fiddle @stephenhuey used, and used the same steps to replicate the issue. It was an issue in 1.2, but 1.3 fixed it.

Check here: http://jsfiddle.net/ADukg/5114/

@RodolpheGohard
Copy link

Well, since 1.3 drops supports for IE8, I won't use it. Does that mean 1.2 branch won't get updates once 1.3 comes out ?

@bramslob
Copy link

bramslob commented Apr 8, 2014

As far as I know, the 1.2 branche will only get bugfixes once 1.3 launches. But that being said, I could not say for sure. But i just updated the jsfiddle to 1.2.16 and it still works:

Check here: http://jsfiddle.net/ADukg/5115/

@RodolpheGohard
Copy link

@bramslob I think we're not looking at the same problem - my bad, I posted in the wrong issue.

If you try to reproduce the scenario described in OP, and check after the ng-model's value, you can see it doesn't get updated on the second "T" keystroke. Try it out: http://jsfiddle.net/ADukg/5116/ hit "TAB" to focus the select, then type "T" twice. The model "person.state" stays to "TN" instead of "TX".

@bramslob
Copy link

bramslob commented Apr 8, 2014

I see what you mean. It happens only once, but still an annoying problem. And i see that it also does not work in 1.3 beta.

I think the best thing to do would be to add a new issue, specifically for your problem. This issue is not completely compatible with your problem.

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

No branches or pull requests

7 participants