docassemble
docassemble copied to clipboard
Cannot disable scrollIntoView = <div> inclusion broken on mobile
As the title says, I cannot (and @jhpyle has confirmed it is not possible to) disable or modify the behavior of the $(daTargetDiv)[0].scrollIntoView() function. There is no documentation on how to "make adjustments in CSS" to get around this, if that is possible.
Expected behavior is that the page on which the Docassemble div is included, will not jump to the div as soon as it loads. I appreciate this may be useful for the default pages and conceivably for iframe inclusion, but it is unexpected and severely limits the viable page layouts otherwise.
I cannot think of any viable fix for this except allowing it to be turned off and leaving developers to manage scrolling when the Docassemble content is included as a div.
The .scrollIntoView()
function is not called if the user is on the first page of the interview. I think you are seeing the scrolling while testing on mobile because you have an input element on the first page of your interview and the JavaScript puts the focus on the element, so the browser is scrolling. A quick fix would be to just have a Continue button on the first page.
In 1.0.3 I disabled the focus when the interview is in embedded mode, so that might give you different results.
Thanks, unfortunately this does not change the behavior. Window still scrolls to the div. This is the view after div load with a "welcome" screen with no input:
I tested it in incognito on mobile Chrome, Safari, and Firefox. It doesn't scroll when you have a Continue button on the first page.
In 1.0.3 I disabled the focus when the interview is in embedded mode, so that might give you different results.
Edit: after purging caches, this seems to have fixed. Thank you!