iron-list
iron-list copied to clipboard
Prepending the backing list does not maintain scroll position
Description
When Items are prepended to an iron-lists backing array the scroll position is not maintained and the users view is automatically scrolled.
For example, when viewing 100th item in a list and the system prepends 50 items to the list the 100th item will be forced off the screen.
This becomes an issue when using iron-scroll-threshold to query the items that are backing an iron-view. If the total number of items allowed in the list is limited and then pruned as the user scrolls down the list, when the user scrolls back up and the missing items are once again retrieved the list jump around unexpectedly.
Expected outcome
When items are prepended to the list of options the scroll position should be captured recalculated and updated so the content the user is viewing is unchanged after the items are added to the list.
Actual outcome
Prepending items to the backing list causes the item the user is original viewing to move down in the list.
Live Demo
http://jsbin.com/qekico/edit?html,output
Clicking the prepend element will move the top element in the list down on the page
Steps to reproduce
- Create an iron-list
- Add an item to the beginning of the iron-lists data list.
Browsers Affected
- [X] Chrome
- [ ] Firefox
- [X] Safari 9
- [ ] Safari 8
- [ ] Safari 7
- [ ] Edge
- [ ] IE 11
- [ ] IE 10