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

select basic directive bug in firefox #2448

Closed
boblepepeur opened this issue Apr 19, 2013 · 13 comments
Closed

select basic directive bug in firefox #2448

boblepepeur opened this issue Apr 19, 2013 · 13 comments

Comments

@boblepepeur
Copy link

Hello, i think i found a bug in angular stable version 1.0.4 and unstable 1.1.4

in angular 1.0.4, line 14489 :

if (existingOption.element.selected !== option.selected) {
lastElement.prop('selected', (existingOption.selected = option.selected));
}
you test a bad properties of js option object
firefox rebuild the list every time on you have a bug onmouseover of the select option list

the good code is that :
if (existingOption.selected !== option.selected) {
lastElement.prop('selected', (existingOption.selected = option.selected));
}

@mbarlow
Copy link

mbarlow commented May 15, 2013

I am experiencing the same problem in unstable 1.1.4.

@boblepepeur
Copy link
Author

with my fix its working

Le 15 mai 2013 à 21:54, Michael Barlow [email protected] a écrit :

I am experiencing the same problem in unstable 1.1.4.


Reply to this email directly or view it on GitHub.

@mbarlow
Copy link

mbarlow commented May 15, 2013

I implemented your change, and it is now working in Firefox 21.0. Thanks!

@boblepepeur
Copy link
Author

Cool I am happy of helping you !!

Envoyé de mon iPhone

Le 15 mai 2013 à 22:47, Michael Barlow [email protected] a écrit :

I implemented your change, and it is now working in Firefox 21.0. Thanks!


Reply to this email directly or view it on GitHub.

@mgladdish
Copy link

What can we do to have this fix folded in to Angular? This bug has caused me pain in 1.0.7 and boblepepeur's fix works for me, too.

@pkozlowski-opensource
Copy link
Member

@mgladdish - very simple - send a pull request with a fix and tests. This is the fastest way of having a bug fix propagated to the AngularJS code base.

@drewwarren
Copy link

A fix for this would be great. It is a pretty big annoyance on pages with real time data which cause digests very frequently.

I made a plunk of the issue: http://embed.plnkr.co/wuKBNc/preview. In firefox open the select box and then hover over any option other than 3.

The proposed fix introduces a regression with selects whose models have a value not in the options list. When you change the model value to be the first option the select will display the second options as selected.

@IgorMinar
Copy link
Contributor

I can still repro this on FF 26 and angular 1.2.8: http://plnkr.co/edit/l8AB62?p=preview

@caitp
Copy link
Contributor

caitp commented Jan 11, 2014

The fix suggested by @boblepepeur fixes the flicker in the repro, but fails in other ways: If you remove the ng-init="selected = 3", you see that it fails to remove the NULL value and doesn't really clean up the selectable options, with that fix (indicated by failing the test should select correct input if previously selected option was "?"). So I guess it's not really a complete solution.

@kumarharsh
Copy link

+1
This bug is happening to me too...

For a long time I was suspecting firefox broke something, but then I didn't encounter the same bug in (of all places!!!) w3schools example, and then I stared to investigate... Never dawned on me that it could be Angular!

@kumarharsh
Copy link

Btw, I'm using Angular 1.2.4, and the bug is still present.

jbalboni pushed a commit to jbalboni/angular.js that referenced this issue Jan 26, 2014
In Firefox, hovering over an option in an open select menu updates the selected property of option
elements. This means that when a render is triggered by the digest cycle, and the list of options
is being rendered, the selected properties are reset to the values from the model and the option
hovered over changes. This fix changes the code to only use DOM elements' selected properties in a
comparison when a change event has been fired. Otherwise, the internal new and existing option
arrays are used.

Closes angular#2448
jbalboni pushed a commit to jbalboni/angular.js that referenced this issue Jan 26, 2014
In Firefox, hovering over an option in an open select menu updates the selected property of option
elements. This means that when a render is triggered by the digest cycle, and the list of options
is being rendered, the selected properties are reset to the values from the model and the option
hovered over changes. This fix changes the code to only use DOM elements' selected properties in a
comparison when a change event has been fired. Otherwise, the internal new and existing option
arrays are used.

Closes angular#2448
@mfollett
Copy link

mfollett commented Feb 7, 2014

I see that the pull request #5994 seems to fix this but has slid a couple of releases. Is there a chance this is going to make it into 1.2.13?

@xdhmoore
Copy link
Contributor

+1

@ashleygwilliams ashleygwilliams added this to the Backlog milestone Feb 21, 2014
caitp pushed a commit to caitp/angular.js that referenced this issue Mar 19, 2014
In Firefox, hovering over an option in an open select menu updates the selected property of option
elements. This means that when a render is triggered by the digest cycle, and the list of options
is being rendered, the selected properties are reset to the values from the model and the option
hovered over changes. This fix changes the code to only use DOM elements' selected properties in a
comparison when a change event has been fired. Otherwise, the internal new and existing option
arrays are used.

Closes angular#2448
Closes angular#5994
caitp pushed a commit to caitp/angular.js that referenced this issue Mar 19, 2014
In Firefox, hovering over an option in an open select menu updates the selected property of option
elements. This means that when a render is triggered by the digest cycle, and the list of options
is being rendered, the selected properties are reset to the values from the model and the option
hovered over changes. This fix changes the code to only use DOM elements' selected properties in a
comparison when a change event has been fired. Otherwise, the internal new and existing option
arrays are used.

Closes angular#2448
Closes angular#5994
@caitp caitp closed this as completed in f40f54c Mar 19, 2014
caitp pushed a commit to caitp/angular.js that referenced this issue Mar 20, 2014
In Firefox, hovering over an option in an open select menu updates the selected property of option
elements. This means that when a render is triggered by the digest cycle, and the list of options
is being rendered, the selected properties are reset to the values from the model and the option
hovered over changes. This fix changes the code to only use DOM elements' selected properties in a
comparison when a change event has been fired. Otherwise, the internal new and existing option
arrays are used.

Closes angular#2448
Closes angular#5994
caitp pushed a commit that referenced this issue Mar 20, 2014
In Firefox, hovering over an option in an open select menu updates the selected property of option
elements. This means that when a render is triggered by the digest cycle, and the list of options
is being rendered, the selected properties are reset to the values from the model and the option
hovered over changes. This fix changes the code to only use DOM elements' selected properties in a
comparison when a change event has been fired. Otherwise, the internal new and existing option
arrays are used.

Closes #2448
Closes #5994
Closes #6769
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.