locomotive-scroll icon indicating copy to clipboard operation
locomotive-scroll copied to clipboard

Chrome update compromising the viability of virtual scroll

Open fcisio opened this issue 2 years ago • 16 comments

Hello 👋 After my latest Google Chrome update, I've started noticing a really bad new feature.

Describe the bug From what I understand, content that is translated outside of the viewport is unmounted by the browser. Only for it the be rendered again once the content gets in the viewport.

For virtual-scroll, this means that the whole content of a page is constantly unmounted and rerendered. In theory, it shouldn't be too bad, but the rerendering is pretty noticeable. What's even more worrying is that content sometimes fails to be rerendered simply by entering the viewport. Meaning that whole pieces of UI can randomly go missing (until something is interacted with and forces the browser to rerender its view).

To Reproduce Steps to reproduce the behavior:

  1. Go to https://locomotive.ca/en
  2. Scroll down a bit
  3. Scroll back up (the quicker the more obvious it is)

Expected behavior The content should not be unmounted when out of the viewport.

I'm aware this is not related to locomotive-scroll, but it impacts it nonetheless. I feel like we should report this issue to chrome or the viability of all virtual scroll library can be compromised.

Report issue:

  1. chrome://settings/help
  2. Report an issue

Desktop (please complete the following information):

  • OS: Big Sur
  • Browser: Chrome
  • Version: v94.0.4606.81

Thank you 👊

fcisio avatar Oct 17 '21 19:10 fcisio

Hello fcisio Same problem here. I reported the problem to google also.

I'm using locomotive scroll on wordpress using oh boiii steroids plugin and since saturday it's a mess. When scrolling up, some UI elements disapear, or take longer to load. When I resize or click these appears again.

I think for now I will have to delete it completly :(

When I look at others website made with locomotive scroll, seems like everything works fine :/

axellelarios avatar Oct 18 '21 20:10 axellelarios

Noticed the same a couple of days back - a temp fix would be to put a position: fixed on the wrapper. In case of the https://locomotive.ca/en would be to do it on [data-load-container].

vitass avatar Oct 19 '21 10:10 vitass

Noticed the same a couple of days back - a temp fix would be to put a position: fixed on the wrapper. In case of the https://locomotive.ca/en would be to do it on [data-load-container].

Cool workaround @vitass ! Not sure I understand how it works tho. Could you elaborate on why it works?

fcisio avatar Oct 19 '21 18:10 fcisio

Same Here, all my websites built with locomotive scroll complaining after Chrome update

html.has-scroll-smooth {
    overflow: hidden;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;  
}

By adding position:fixed works fine for now, but I'm not sure if it's a perfect way to resolve this issue

Dushyant1295 avatar Nov 01 '21 08:11 Dushyant1295

Noticed the same a couple of days back - a temp fix would be to put a position: fixed on the wrapper. In case of the https://locomotive.ca/en would be to do it on [data-load-container].

@vitass Man, you are a life saver! 🙏

abdulrauf11 avatar Nov 04 '21 16:11 abdulrauf11

I am working on a client site built with locomotive then recently discovered this sad issue... and reported to Google already. Thanks for the fix anyway I will try and investigate if there is a better one, but it would be preferable that Chrome team improve this new "feature".

Still an issue in Chrome Canary v97 at this time of writing.

xavierfoucrier avatar Nov 05 '21 22:11 xavierfoucrier

same problem, solved with html.has-scroll-smooth { backface-visibility: hidden; transform: translateZ(0); }

friconelli avatar Nov 11 '21 09:11 friconelli

I found that Chrome is repainting lots of elements during the scroll, maybe the problem is related to that. The html "position: fixed" helps to keep the elements in view but unfortunately the repaint is still there.

gfnool avatar Nov 11 '21 11:11 gfnool

@gfnool @friconelli

it seems like this issue is related to Paint Complexity

by adding transform: translateZ(0);

will force the browser to use hardware acceleration for paint and also works fine

Dushyant1295 avatar Nov 13 '21 00:11 Dushyant1295

@Dushyant1295 Looks like for Chrome it's not enough for repainting. Using only transform: translateZ(0); doesn't seem to work, I guess you probably have additional styles on the element.

This fixed the issue on my side:

.has-scroll-smooth {
  position: fixed;
  inset: 0;
}

xavierfoucrier avatar Nov 15 '21 09:11 xavierfoucrier

@Dushyant1295 Looks like for Chrome it's not enough for repainting. Using only transform: translateZ(0); doesn't seem to work, I guess you probably have additional styles on the element.

This fixed the issue on my side:

.has-scroll-smooth {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

This one work perfectly for me!

Azolia-Design avatar Nov 22 '21 11:11 Azolia-Design

@Dushyant1295 Looks like for Chrome it's not enough for repainting. Using only transform: translateZ(0); doesn't seem to work, I guess you probably have additional styles on the element.

This fixed the issue on my side:

.has-scroll-smooth {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

Why I am the only one :( this is not working for me I am not able to scroll after adding fixed position

itisyb avatar Dec 26 '21 17:12 itisyb

I noticed that there was no screen recording of the issue, so here is an example of the problem, for clarity: https://www.loom.com/share/76500d232aa64ea1ae98601663968677

Note in my case, adding the following fixes the issue whilst Google hopefully works on a solution:

html.has-scroll-smooth {
	backface-visibility: hidden;
	transform: translateZ(0);
}

[data-load-container] {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	width: 100vw;
}

elliottmangham avatar Jan 10 '22 13:01 elliottmangham

Is there any new solutions? I am facing the same in Chrome

Artem-Semenov avatar Nov 21 '22 07:11 Artem-Semenov

@Artem-Semenov see https://github.com/locomotivemtl/locomotive-scroll/issues/353#issuecomment-968698052.

As stated / explained on the main readme: "Scroll-hijacking is a controversial practice that can cause usability, accessibility, and performance issues."

xavierfoucrier avatar Nov 21 '22 09:11 xavierfoucrier

In case someone still have an issue, you can do the trick by resizing the window

window.addEventListener('load', function () {
     var resizeEvent = new Event('resize');
     window.dispatchEvent(resizeEvent);
});

OussamaKhoubran avatar Apr 17 '23 18:04 OussamaKhoubran