Bug 245300 - REGRESSION (251454@main): Setting scrollTop on fixed element with overflow breaks scrolling on a 'overscroll-behavior:none' page
Summary: REGRESSION (251454@main): Setting scrollTop on fixed element with overflow br...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Major
Assignee: Nikos Mouchtaris
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-09-16 14:04 PDT by Jack Doyle
Modified: 2022-12-09 19:47 PST (History)
5 users (show)

See Also:


Attachments
Reduced testcase (909 bytes, text/html)
2022-09-16 14:27 PDT, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.