Bug 240892 - Neither preventDefault on GestureEnd nor CSS overscroll stop the Safari "Tab Expose" feature or page navigation
Summary: Neither preventDefault on GestureEnd nor CSS overscroll stop the Safari "Tab ...
Status: RESOLVED DUPLICATE of bug 233141
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Safari 15
Hardware: Mac (Intel) macOS 12
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-05-24 16:09 PDT by Jarod Gowgiel
Modified: 2022-08-04 08:54 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jarod Gowgiel 2022-05-24 16:09:37 PDT
When zooming out on a web page, Safari triggers a "Tab Expose" view as a result of overscroll, and when scrolling backwards or forwards triggers navigation.

I'd expect that, similar to other gestures, calling preventDefault() on the resulting GestureEnd would prevent these system gestures from occurring, but that isn't the case. On iOS, it's a known workaround to preventDefault() on the touchstart event that begins the gesture, but similar workarounds (like preventDefault() on the mousedown) seem to not have the same effect on macOS in Safari from my experimentation.

As an alternate approach, I also tried out overscroll-behavior. The specification for overscroll-behavior (which will be the [new default soon](https://bugs.webkit.org/show_bug.cgi?id=236060) and that I experimented with activating for myself locally via the "Experimental Features") states that "[contain] indicates that the element must not perform non-local boundary default actions such as scroll chaining or navigation." Even when applying "overscroll-behavior: contain" to an element, both of these non-local interactions (swiping backwards, and pinching to zoom) are still triggered.
Comment 1 Sam Sneddon [:gsnedders] 2022-05-26 10:09:12 PDT
This sounds like another issue caused by Safari being in control of this UI behaviour without really knowing what's going on with the web content.
Comment 2 Jarod Gowgiel 2022-05-26 14:29:28 PDT
After some further experimentation, it seems like calling preventDefault() on the "wheel" event fired by Safari while panning around the trackpad does prevent page navigation, but has no impact on the "Tab Expose" gesture. "overscroll-behavior: contain" still seems to not stop either type of gesture, though.
Comment 3 Alexey Proskuryakov 2022-05-28 17:50:50 PDT
When considering changes in this area, we need to keep in mind whether preventing standard browser behaviors is user friendly. It often isn’t.
Comment 4 Radar WebKit Bug Importer 2022-05-31 16:10:13 PDT
<rdar://problem/94184281>
Comment 5 Sam Sneddon [:gsnedders] 2022-08-04 08:54:31 PDT

*** This bug has been marked as a duplicate of bug 233141 ***