Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
218 views
in Technique[技术] by (71.8m points)

javascript - With flexbox and "column-reverse", the page jumps when scrolling on Chrome

I've been trying to figure out the issue for days, but I still can't reproduce it outside of my web app.

I have a scrollable list that looks something like this: https://codesandbox.io/s/jolly-galileo-gk5x1?file=/src/App.js

When scrolling up, new items are loaded on top. I need flex-direction: column-reverse to scroll to the bottom as soon as the page is loaded.

The issue is that when a new item is loaded, it often scrolls up by a few hundred pixels. It happens when I scroll with a mouse or a trackpad on Chrome. It doesn't occur in Firefox, Edge, or Chrome when simulating touch using mobile mode. I couldn't reproduce it in the CodeSandbox link above and my web app isn't live yet.

Adding overflow-anchor: none didn't fix it. What are some other possible issues? I rewrote the c ode several times, so I think it's likely a browser quirk. Also, I don't think this issue occurred before I updated to Chrome 87.

Edit: Disabling smooth scroll seems to fix it. Still trying to figure out how to fix smooth scroll.

Smooth scroll on: https://imgur.com/HJz3n0T

Smooth scroll off: https://imgur.com/ugxxJlc

question from:https://stackoverflow.com/questions/65640888/with-flexbox-and-column-reverse-the-page-jumps-when-scrolling-on-chrome

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...