WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
173830
dom change will cause jump when "container's -webkit-scroll-snap-type is mandatory" and "item's width is percent"
https://bugs.webkit.org/show_bug.cgi?id=173830
Summary
dom change will cause jump when "container's -webkit-scroll-snap-type is mand...
zhouqi
Reported
2017-06-26 05:55:25 PDT
// HTML: <ul> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> // CSS: ul{ display: flex; -webkit-overflow-scrolling: touch; -webkit-scroll-snap-type: mandatory; // scroll-snap overflow-x: scroll; } li{ -webkit-scroll-snap-coordinate: 0 0; width: 30%; // width is percent } // JS: document.querySelector('ul').addEventListener('scroll', function(){ Array.from(document.querySelectorAll('li')).forEach(function(li, index){ li.innerText = Date.now(); // Change the item's dom }) }) Any dom change will cause the scroll position jump when "the li's width is percent" and "the ul's -webkit-scroll-snap-type is mandatory", vw\rem\em\px... will not cause this issue. This bug causes the horizontal scroll-snap with lazyload(lazyload will change the img src when scrolling) to be completely unavailable. System:iOS 10.3 + Safari/WKWebview (mac safari 10.1.1 is ok) DEMO:
https://codepen.io/zhouqicf/pen/owGPKe
Bug Video:
http://cloud.video.taobao.com/play/u/370670821/p/1/e/6/t/1/57871314.mp4
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2017-06-26 08:53:42 PDT
<
rdar://problem/32981068
>
zhouqi
Comment 2
2017-10-24 21:00:52 PDT
any process? I find any reflow will cause this bug. for example: .item{ border: 6px solid transparent; } // reflow: this border-width change will cause this bug .item.active{ border-width: 10px; } // repaint: this border-color change will not cause this bug .item.active{ border-color: #fff; }
zhouqi
Comment 3
2017-10-24 21:02:12 PDT
scroll-snap-align has this bug also in iOS 11 .container{ scroll-snap-type: mandatory; } .item{ scroll-snap-align: start center; }
Wenson Hsieh
Comment 4
2017-10-24 21:13:52 PDT
(In reply to zhouqi from
comment #3
)
> scroll-snap-align has this bug also in iOS 11 > > .container{ > scroll-snap-type: mandatory; > } > .item{ > scroll-snap-align: start center; > }
Scroll snap offsets jumping during layout is a known issue, and one that's tricky to fix. What's probably happening is that code to restore the active snap index (e.g. to keep the active scroll snap point the same after device rotation) is triggered as a post layout task after the layout happens due to reflow, which causes the scroll offset to try and jump in the middle of a scroll snap animation. I have some ideas about how to decouple this mechanism to restore active scroll snap index restoration from the frame layout lifecycle...
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug