This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
multiple select always jumps back to lowest marked element #15477
Milestone
Comments
This also happens on Chrome btw. |
Maybe it's because we re-set some attributes. I hope it's not because the options get re-rendered ... which shouldn't happen (haven't tested if it does) |
In Chrome, it only happens if you have one element selected (e.g. select 10, then scroll back to 1, then digest). I suspect it is because of this method. |
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Dec 8, 2016
Previously, when updating the value of a `select[multiple]` element, all options were first set to `selected = false` and then the selected ones where set to `true`. By setting an already selected option to `selected = false` and then `true` again - essentially unselecting and reselecting it - caused some browsers (including Firefox, IE and (under some circumstances) Chrome) to scroll to unexpectedly scroll to the last selected option. This commit fixes it by ensuring that the `selected` property is set to its final value and only if that value is different than the previous one, thus avoiding the undesirable behavior. Fixes angular#15477
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Dec 8, 2016
Previously, when updating the value of a `select[multiple]` element, all options were first set to `selected = false` and then the selected ones where set to `true`. By setting an already selected option to `selected = false` and then `true` again - essentially unselecting and reselecting it - caused some browsers (including Firefox, IE and (under some circumstances) Chrome) to scroll to unexpectedly scroll to the last selected option. This commit fixes it by ensuring that the `selected` property is set to its final value and only if that value is different than the previous one, thus avoiding the undesirable behavior. Fixes angular#15477
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Dec 8, 2016
Previously, when updating the value of a `select[multiple]` element, all options were first set to `selected = false` and then the selected ones where set to `true`. By setting an already selected option to `selected = false` and then `true` again - essentially unselecting and reselecting it - caused some browsers (including Firefox, IE and (under some circumstances) Chrome) to scroll to unexpectedly scroll to the last selected option. This commit fixes it by ensuring that the `selected` property is set to its final value and only if that value is different than the previous one, thus avoiding the undesirable behavior. Fixes angular#15477
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Dec 8, 2016
Previously, when updating the value of a `select[multiple]` element, all options were first set to `selected = false` and then the selected ones were set to `true`. By setting an already selected option to `selected = false` and then `true` again - essentially unselecting and reselecting it - caused some browsers (including Firefox, IE and under some circumstances Chrome) to unexpectedly scroll to the last selected option. This commit fixes it by ensuring that the `selected` property is only set if its current value if different than the new one and even then it is set to its final value at once (i.e. without first setting it to `false`), thus avoiding the undesirable behavior. Fixes angular#15477
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Dec 8, 2016
Previously, when updating the value of a `select[multiple]` element, all options were first set to `selected = false` and then the selected ones were set to `true`. By setting an already selected option to `selected = false` and then `true` again - essentially unselecting and reselecting it - caused some browsers (including Firefox, IE and under some circumstances Chrome) to unexpectedly scroll to the last selected option. This commit fixes it by ensuring that the `selected` property is only set if its current value is different than the new one and even then it is set to its final value at once (i.e. without first setting it to `false`), thus avoiding the undesirable behavior. Fixes angular#15477
3 tasks
gkalpak
added a commit
that referenced
this issue
Dec 19, 2016
Previously, when updating the value of a `select[multiple]` element, all options were first set to `selected = false` and then the selected ones were set to `true`. By setting an already selected option to `selected = false` and then `true` again - essentially unselecting and reselecting it - caused some browsers (including Firefox, IE and under some circumstances Chrome) to unexpectedly scroll to the last selected option. This commit fixes it by ensuring that the `selected` property is only set if its current value is different than the new one and even then it is set to its final value at once (i.e. without first setting it to `false`), thus avoiding the undesirable behavior. Fixes #15477 Closes #15478
ellimist
pushed a commit
to ellimist/angular.js
that referenced
this issue
Mar 15, 2017
Previously, when updating the value of a `select[multiple]` element, all options were first set to `selected = false` and then the selected ones were set to `true`. By setting an already selected option to `selected = false` and then `true` again - essentially unselecting and reselecting it - caused some browsers (including Firefox, IE and under some circumstances Chrome) to unexpectedly scroll to the last selected option. This commit fixes it by ensuring that the `selected` property is only set if its current value is different than the new one and even then it is set to its final value at once (i.e. without first setting it to `false`), thus avoiding the undesirable behavior. Fixes angular#15477 Closes angular#15478
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I think angular background magic bred this bug.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).
It's only a minimal example, i build this in different cases but i can't post the original source code.
special look at the
$interval(function() {}, 100);
What is the expected behavior?
Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Other information (e.g. stacktraces, related issues, suggestions how to fix)
sorry for my bad english, I'm from Germany.
with best regards
Sogmog
The text was updated successfully, but these errors were encountered: