Bug 245300

Summary: REGRESSION (251454@main): Setting scrollTop on fixed element with overflow breaks scrolling on a 'overscroll-behavior:none' page
Product: WebKit Reporter: Jack Doyle <jack>
Component: ScrollingAssignee: Nikos Mouchtaris <nmouchtaris>
Status: RESOLVED FIXED    
Severity: Major CC: nmouchtaris, simon.fraser, supermoos, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=238497
Attachments:
Description Flags
Reduced testcase none

Description Jack Doyle 2022-09-16 14:04:00 PDT
Here's an isolated demo: 
https://codepen.io/GreenSock/pen/YzLZVOz

Notice that if you set overscrollBehavior on the body/html and then set the scrollTop of a position: fixed element, suddenly it becomes impossible to scroll the page at all in Safari 16! It's a pretty show-stopping behavior. 

If you set the position back to absolute before setting scrollTop and then switch it back to position fixed, that seems to work. Obviously that shouldn't be necessary.
Comment 1 Simon Fraser (smfr) 2022-09-16 14:27:21 PDT
Created attachment 462405 [details]
Reduced testcase

The overflow:hidden position:fixed intercepts scrolling (you can still scroll the page  when the cursor is outside it).
Comment 2 Jack Doyle 2022-09-16 15:17:04 PDT
Are you saying you think this is the correct behavior? It definitely seems way wrong to me, and no other browser behaves this way. Also, once it's "stuck" and then you drag the scrollbar a bit, it becomes "unstuck" so your explanation about intercepting the scroll seems inconsistent at best. 

Or am I missing something?
Comment 3 Simon Fraser (smfr) 2022-09-16 15:41:26 PDT
No, it's a bug, but your testcase was a little misleading because your fixed element covers the entire viewport. The page is scrollable if your cursor isn't over the position:fixed.
Comment 4 Simon Fraser (smfr) 2022-09-16 15:41:48 PDT
The position:fixed is "trapping" the wheel events incorrectly.
Comment 5 Jack Doyle 2022-09-16 15:46:33 PDT
I see. Yeah, I need the full-screen position: fixed element in my use case. 

Thanks for looking into this.
Comment 6 Simon Fraser (smfr) 2022-09-16 21:27:24 PDT
This happens as a result of adding the overflow's ScrollableArea to the FrameView's scrollable area set, which means we add it to the non-fast scrollable region in ScrollingCoordinator::absoluteEventTrackingRegionsForFrame().

This is fallout from 251454@main.
Comment 7 Radar WebKit Bug Importer 2022-09-16 21:27:49 PDT
<rdar://problem/100057532>
Comment 8 Nikos Mouchtaris 2022-09-28 15:55:42 PDT
Pull request: https://github.com/WebKit/WebKit/pull/4810
Comment 9 EWS 2022-12-09 19:47:30 PST
Committed 257665@main (b08436732d9d): <https://commits.webkit.org/257665@main>

Reviewed commits have been landed. Closing PR #4810 and removing active labels.