scroll position is not restored when using defaultPageTransition = "none" #7148
Comments
A simplified test:
It's only broken on Chrome (so, presumably on Blink/Webkit) |
Steps:
|
Starting a table:
|
I've isolated the problem a bit on Chrome 32/Linux: It turns out that the pagecontainer stops receiving scrollstop events after you come back from Page 2. |
Actually, it's broken on FF too ... you just have to go to Page 2 one more time. |
Tracing further on Chrome ... when you come back from Page 2, the page container's _disableRecordScroll method gets called so it stops recording scrollTop. |
The reason it stops working is that the pagecontainer does not receive a navigate event when returning from Page 2. It has a handler for navigate which would turn scroll recording back on. On FF it receives the navigate event upon the first return, but not the second, and on Chrome it doesn't receive the navigate event even after the first return. |
Basically, pagecontainer has a flag |
Why does pagecontainer have a navigate event handler which turns off |
OK. I believe I have identified the root cause. During The solution is simple: Attach the handler that performs the page change after the handler that turns off the scrolling. |
Thanks for this Gabriel. I've tested and works perfect. Thanks for the hard work! |
Hi guys -
Hopefully I can make this understandable.
ISSUE DESCRIPTION
I currently use $.mobile.defaultPageTransition = "none" on my site.
When clicking a link on my search results page, then clicking a data-rel="back" link from the details page, the scroll position on the search results is not correctly restored, and seems to always return to the position of the first item clicked.
TEST PAGE
http://jsbin.com/IFolanOW/281/edit
STEPS TO REPRODUCE ISSUE
STEPS TO REPRODUCE CORRECT BEHAVIOR
EXPECTED OUTCOME
Position of last item clicked on search results when clicking 'back' would be restored to clicked position (normal browser behavior)
ACTUAL OUTCOME
Seems like the first item clicked is cached, and you will always return to that item.
PLATFORMS
Chrome desktop (most recent)
Safari iOS7
The text was updated successfully, but these errors were encountered: