Issue #2722Opened April 17, 2020by tomaskallup0 reactions

[BUG] Highlight and toolbar positioned wrong on outside scroll

Question

Are you using the latest release (older versions are NOT supported)? Yes Are you facing the bug with your local copy of GrapesJS or with the current demo? Local

  • OS: Archlinux
  • Browser: Firefox 74.0 and Firefox developer edition 75.0b11
  • Grapes: v0.16.3

What is the expected behavior?

  • Highlight should update its position when the outside scrolls

What happens instead? grapes-scroll-issue

I did my best to try and replicate this behaviour, but couldn't. Even using the same stack (parcel, typescript, react, ant design) it seemed to work. So I would like some insight as to how I can debug this.

Looking at the events in inspector, the scroll event is there. image In my replication attempt (https://github.com/tomaskallup/grapesjs-react-scroll-issues) about the same styles should be applied (there is a flexbox which has scrolling content), but the issue isn't present there. (UPDATE Repo has been updated, issue is now present there, see https://github.com/artf/grapesjs/issues/2722#issuecomment-617154850) If I switch the editor to fullscreen, it works perfectly.

Answers (3)

artfApril 21, 20200 reactions

Yeah really weird, my first guess was that canvas toolbars weren't updating on the window scroll, so I've tried to create a non-fullscreen example with a long page but I've realized that there is no scroll listener (on the main window) because is not necessary, toolbars are positioned correctly without that listener. So, the only reasonable problems I can think about might be the Firefox browser (so try to see your page in Chrome, please) or maybe you're loading your page inside an iframe because that might be an issue, in that case, you would need to set up a scroll listener and propagate it to the editor

tomaskallupApril 21, 20200 reactions

Hi, thanks for the reply!

Firefox doesn't seem to be the issue here (same behaviour in Chrome) image Also the replication repo works in both browsers without the bug.

I'm not loading anything in iframe (this is inspector layout from the actual page) image Only custom styles applied to the upper elements are some margins, paddings, min-height and max-width. Looking at it, the content seems pretty much same as in the replication repository, so I'm just getting more and more confused.

One thing I noticed, it "fixes" itself when resizing window (untill you scroll again)

tomaskallupApril 21, 20200 reactions

@artf I think I found the cause, our root element <div id="❤"> has this style:

#❤ {
    height: 100vh;
    display: flex;
}

Adding that to the reproduction repo caused the issue to appear! (Removing the flex seems to fix the issue, I'll investigate if we really need it in our case, but atleast now there's actual reproduction)

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.