Overview
When a user takes actions that result in the height of the previewed page increasing or decreasing, the canvas dynamically changes height to accommodate. Because the iFrame is vertically aligned in the center of the canvas, when its height changes, the iFrame appears to jump up or down.
This issue is fairly long standing I think but became much more apparent after #3469894: [later phase] Total canvas size should be dynamic based on browser viewport size and #3469677: Remove flickering when preview is being updated were both in place.
Proposed resolution
Before updating the preview take note of the position on screen of the .previewContainer (e.g. how many pixels from the top left of the screen is the top left of the .previewContainer)
After the preview has updated update the scroll position of the canvas to ensure the top left of the .previewContainer back to what it was.


| Comment | File | Size | Author |
|---|---|---|---|
| #8 | Untitled.gif | 820.62 KB | gauravvvv |
| #2 | 3475484-error.png | 786.61 KB | nayana_mvr |
| jump after typing.gif | 761.73 KB | jessebaker | |
| jump after drag.gif | 2.04 MB | jessebaker |
Issue fork experience_builder-3475484
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nayana_mvr commentedHi @jessebaker, I tried to reproduce this issue in Drupal cms, but I'm getting some error. Steps followed:-
Please let me know if I'm missing some steps here. Also please update the Issue Summary with steps to reproduce.
Comment #3
gauravvvv commentedComment #4
wim leers#2: that is for sure unrelated to the Experience Builder module.
Comment #5
wim leers#2: that is for sure unrelated to the Experience Builder module.
Comment #7
gauravvvv commentedComment #8
gauravvvv commentedAfter MR

Comment #9
wim leersThanks, @gauravvvv!
Comment #10
kristen polFixing tag
Comment #11
jessebaker commentedThis MR !327 doesn't address the problem but instead removes the functionality that causes the problem. At first this seemed to be the wrong solution but actually gave me an idea!
In #3469894: [later phase] Total canvas size should be dynamic based on browser viewport size functionality was added to make the canvas height dynamic based on the content. However in this MR some of that functionality was removed - and yet a small padding was still present because of the CSS. Surely I could just add additional padding in CSS!
Given that the "dynamic" height was just adding extra height/width equal to 80% of the viewport's height/width it occured to me that I could use vh and vw units in CSS to achieve the same thing and remove the JS (and the resize observer!) that was making that calculation.
Comment #12
wim leersComment #13
balintbrewsComment #15
balintbrewsI really like this solution! 👏🏻