position:sticky scrollIntoView in a scroll event listener stops the ongoing scroll if the element is already in the view
Categories
(Core :: Panning and Zooming, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox151 | --- | fixed |
People
(Reporter: saschanaz, Assigned: dshin)
References
Details
(Keywords: webcompat:platform-bug)
User Story
user-impact-score:200
Attachments
(3 files)
- Open the attachment
- Try scrolling
Chrome: Scroll feels fast and smooth
Firefox: Scroll is slow
Updated•5 months ago
|
Comment 1•5 months ago
|
||
I believe this is position:sticky specific. We do basically bailout from scrollIntoView relevant functions if the destination is same as before;
// If we don't need to scroll, then don't try since it might cancel
// a current smooth scroll operation.
if (scrollPt == originalScrollPt) {
return Nothing();
}
But in position:sticky case, the calculation of the destination is not so smart I guess.
Setting P3:S3 since the user impact score is quite low, 40.
Updated•5 months ago
|
| Reporter | ||
Comment 2•5 months ago
|
||
And then it became 200...
| Assignee | ||
Updated•4 months ago
|
| Assignee | ||
Comment 3•4 months ago
•
|
||
So it is sticky-specific in the sense that the code path isn't really taken e.g. for the fixed element, but the root cause is with the computation of horizontal scroll.
We end up trying to center the scroll target horizontally, and this means that we end up with a negative scroll offset. This causes the bailout code in Bug 2019912 Comment 1 to be skipped.
I've modified the testcase's scroll target, #target, to use a display: block element (i.e. <div>) - With width: fit-content, centering the target would involve scrolling left, which computes as a negative scroll offset. This prevents the bailout, leading to the buggy behaviour because originalScrollPt is based on GetVisualViewportOffset(), which wouldn't include this negative scroll offset. OTOH, setting width: 100vw causes the target horizontal scroll offset 0, avoiding the buggy behaviour.
I would think that the the scroll offsets should be clamped to prospective min/max values, but we in fact force the range to include the computed offset, which is curious. It points to bug 681192, which I will have to investigate a bit.
| Assignee | ||
Comment 4•4 months ago
|
||
Comment 7•4 months ago
|
||
| bugherder | ||
Comment 9•4 months ago
|
||
Thank again David!
Updated•3 months ago
|
Description
•