Cms: Preview pane won't scroll

Created on 6 Aug 2020  ·  13Comments  ·  Source: craftcms/cms

Description

When editing an entry, the right preview pane is stuck to the top position, I'm unable to scroll down
Tested with Google Chrome. Firefox and Safari on Mac

Steps to reproduce

  1. Edit an entry
  2. try to scroll down on a larger page

Additional info

  • Craft version: 3.5
  • PHP version: 7.2.31
  • Database driver & version: 5.0.12
  • Plugins & versions: Redactor
bug

Most helpful comment

@mmikkel You can completely disable iFrame Resizer by setting the previewIframeResizerOptions config setting to false. But then your scroll position will stop being maintained between page loads. I suppose I can bring back what we were doing before in that case.

All 13 comments

Is your front-end being rendered by Craft? And is it on the same domain name as the control panel? (If “no” for either of those, please elaborate.)

I'm experiencing the same problem. The <iframe class="lp-preview"> is set to scrolling="no" and if I change that to scrolling="yes" it works just fine.

@prescottcarr same questions to you.

I've managed to narrow the issue down to the css file. If this is set:
body, html { height: 100%; scroll-behavior: smooth; }
It's impossible to scroll.
The page is rendered by craft and on the same domain.

Aha. So in 3.5, we are now using iFrame Resizer to set the height of the iframe based on its document height, and scrolling the iframe’s container div, rather than the iframe window itself (hence the scrolling="no" on the iframe). Reason we made this change is to fix some issues with maintaining the iframe scroll position between page loads, which is 100% reliable now.

If you have height:100% set for html and body, then this seems expected. You are telling the browser you want the height of the document to equal the height of the window. If the content goes beyond that, when you scroll down in a normal browser window, you’re actually scrolling passed the bounds of the document. But iFrame Resizer probably isn’t concerned with bleeding content; just the document height.

You should be able to fix this by changing height: 100% to min-height: 100%.

Thanks Brandon, that works for me 👍

@brandonkelly This change means that no scroll events will fire on the website being previewed, and its scrollTop will be stuck at 0. For some designs, this can actually be a big problem 😬 Might be worth considering a per-preview target setting (in the vein of "Refresh") to disable iFrame Resizer and enable scrolling on the actual iframe (i.e., make it work like before)?

@mmikkel You can completely disable iFrame Resizer by setting the previewIframeResizerOptions config setting to false. But then your scroll position will stop being maintained between page loads. I suppose I can bring back what we were doing before in that case.

@brandonkelly Nice, hadn't seen that setting. If it's possible to bring back the old method for maintaining scroll pos if/when Iframe Resizer is disabled, that sounds like a good solution.

"position: fixed" does not work neither. fixed element will scroll in preview.

fixed with 'previewIframeResizerOptions' => false

Alright, made that change for the next release.

Craft 3.5.2 is out now, which restores the old scroll behavior when previewIframeResizerOptions is set to false.

We just released Craft 3.5.5, which disables the new iFrame Resizer-based behavior by default (see #6645).

Was this page helpful?
0 / 5 - 0 ratings