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

In Firefox when a model is changed, other elements are re-rendered #3753

Closed
yeukhon opened this issue Aug 26, 2013 · 5 comments
Closed

In Firefox when a model is changed, other elements are re-rendered #3753

yeukhon opened this issue Aug 26, 2013 · 5 comments

Comments

@yeukhon
Copy link

yeukhon commented Aug 26, 2013

Foxandxss on IRC helped me to verify this issue.
Try this on Firefox http://plnkr.co/edit/MziozEZq9KBhYsyuZas9?p=preview (I am using FF-23 stable, but other versions should have the same issue)

If you let the <select> element open, move your cursor to a lower item, wait a few seconds, you will see the highlight cursor moves back to the top as the number on the right changes.

In my application, I have a table and a <select>. Each is bind to a model, but <select> is initialized once whereas the table gets updated every 3 seconds using $timeout (we poll).

In Chrome (Google Chrome 27.0.1453.93 (Official Build 200836)) I don't see this problem.

@stephank
Copy link

Cause of this is a <select> element with ng-options refreshing itself on each loop iteration. The code is careful enough not to completely rebuild the options list, but simply updates items.

However, Firefox updates the <option> elements' selected properties as the user browses the drop-down, causing Angular to try and 'fix' the selection every loop iteration.

@yeukhon
Copy link
Author

yeukhon commented Oct 31, 2013

@stephank Is there a way to fix this issue? Is this browser implementation issue?

@stephank
Copy link

Regardless of whether this is a browser bug, a work around is probably possible.

That said, I don't think Firefox is following spec. Here's a quote from the current HTML5 spec on <select>:

If the multiple attribute is absent, and the element is not disabled, then the user agent should allow the user to pick an option element in its list of options that is itself not disabled. Upon this option element being picked (either through a click, or through unfocusing the element after changing its value, or through a menu command, or through any other mechanism), and before the relevant user interaction event is queued (e.g. before the click event), the user agent must set the selectedness of the picked option element to true and then queue a task to fire a simple event that bubbles named change at the select element, using the user interaction task source as the task source.

@stephank
Copy link

@btford btford added this to the Backlog milestone Feb 5, 2014
@btford btford removed the gh: issue label Aug 20, 2014
@Narretz Narretz removed the PRs plz! label Aug 13, 2015
@Narretz
Copy link
Contributor

Narretz commented Aug 13, 2015

This is actually fixed since at least 1.2.28

@Narretz Narretz closed this as completed Aug 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants