#17740 closed defect (fixed)
dojo/window#scrollIntoView() broken on iOS on RTL page
Reported by: | bill | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.7.6 |
Component: | Core | Version: | 1.9.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
window.scrollIntoView() will scroll the page far to the left, even when it doesn't need to. Happens on RTL document on iOS, but works on chrome.
See attached test case:
- load page on iPad in portrait mode
- scroll to right
- press
scroll "node" into view
button
Since node
is already in view, nothing should happen. Yet, the screen scrolls far to the left, vanishing all the text.
Attachments (1)
Change History (11)
Changed 7 years ago by
Attachment: | scroll.html added |
---|
comment:1 Changed 7 years ago by
I have observed this issue more generally without an RTL doc. It appears to be caused by iOS resetting body.scrollTop
when body.scrollLeft
is set and vice versa. I plan to submit a pull request for a workaround in dojo/window
tomorrow.
comment:2 Changed 7 years ago by
I found an issue in the workaround and fixed it, but I am now seeing some rtl-related test failures. I plan to work on this but will likely not get back to it today.
The basic idea of the workaround is to use the scrollBy method on the parent window when scrolling a body
. This causes the scroll.html
test case to work as expected. I am interested to hear if anyone has concerns about this approach.
comment:3 Changed 7 years ago by
Sounds interesting. Not sure if scrollTo() or scrollBy() is easier. Seems like it would be easier to convert the current code to use scrollTo(). But probably you know something I don't.
comment:4 Changed 7 years ago by
I submitted a PR to fix this: https://github.com/dojo/dojo/pull/66
It addresses the reduced test case and does not cause any unit test failures. I wanted to add a unit test for this, but the dojo/window
tests are broken on iOS (maybe because newer iOS versions don't respect iframe height set by the host page), and I don't have time to fix them. I might work on that as part of the doh-to-intern conversion.
comment:5 Changed 7 years ago by
Owner: | set to Brandon Payton <[email protected]…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:10 Changed 7 years ago by
Milestone: | tbd → 1.7.6 |
---|
test case showing problem