Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome update compromising the viability of virtual scroll #353

Open
fcisio opened this issue Oct 17, 2021 · 16 comments
Open

Chrome update compromising the viability of virtual scroll #353

fcisio opened this issue Oct 17, 2021 · 16 comments

Comments

@fcisio
Copy link

fcisio commented Oct 17, 2021

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 👊

@axellelarios
Copy link

axellelarios commented Oct 18, 2021

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 :/

@vitass
Copy link

vitass commented Oct 19, 2021

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].

@fcisio
Copy link
Author

fcisio commented Oct 19, 2021

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?

@Dushyant1295
Copy link

Dushyant1295 commented Nov 1, 2021

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

@abdulrauf11
Copy link

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! 🙏

@xavierfoucrier
Copy link
Contributor

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.

@friconelli
Copy link

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

@gfnool
Copy link

gfnool commented Nov 11, 2021

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.

@Dushyant1295
Copy link

Dushyant1295 commented Nov 13, 2021

@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

@xavierfoucrier
Copy link
Contributor

xavierfoucrier commented Nov 15, 2021

@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;
}

@Azolia-Design
Copy link

@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!

@itisyb
Copy link

itisyb commented Dec 26, 2021

@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

@elliottmangham
Copy link

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;
}

@Artem-Semenov
Copy link

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

@xavierfoucrier
Copy link
Contributor

@Artem-Semenov see #353 (comment).

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

@OussamaKhoubran
Copy link

OussamaKhoubran commented Apr 17, 2023

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);
});

Amir-A-M added a commit to Amir-A-M/RajaeeSchool that referenced this issue Aug 4, 2023
Amir-A-M added a commit to Amir-A-M/RajaeeSchool that referenced this issue Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests