Created attachment 438802 [details] Compat table Firefox [1] and Chrome [2] both map pinch-to-zoom gestures to the WheelEvent with the meta key pressed (see attached screenshot for compatibility). This makes detecting zoom gestures super easy, but it's hard to do the same in Safari. `GestureEvent` is not supported on any other browser [3], so it would be nice if Safari supported the mapping mentioned above. —— [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1052253 [2] https://bugs.chromium.org/p/chromium/issues/detail?id=289887 [3] https://developer.mozilla.org/en-US/docs/Web/API/GestureEvent#browser_compatibility
Addendum: The standards-based Safari way is documented in https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events/Pinch_zoom_gestures.
Why do we want web pages to detect zooming? As a user, I just want the browser to zoom, and absolutely don't want the webpage to change anything as I'm doing that.
The use case here would be pinch-zooming parts of an app. Example: go to https://jakearchibald.github.io/svgomg/, click “Demo” and pinch-zoom the 🚗.
This was implemented in https://bugs.webkit.org/show_bug.cgi?id=225788 *** This bug has been marked as a duplicate of bug 225788 ***
Oh, that’s amazing and I missed this. Thanks for implementing this! Can you tell me as of which Safari release on mobile this will land? I think it’s not part of iOS 15, but I may be wrong.
The implementation was macOS-only (we only dispatch wheels events on iOS when using the Magic Keyboard, and there you have a trackpad which supports pinch-zoom already). You can test in Safari Tech Preview on Mac.
Thanks, Simon, this explains why I wasn’t seeing it on mobile Safari. Since Firefox and Chrome on Android expose this (see https://bugs.webkit.org/attachment.cgi?id=438802), could you consider exposing this as well?
To be clear, are you expecting pinch-zoom on the iPhone/iPad screen to generate wheel events with the Ctrl key set?
Yes, since this lets developers create zoom UIs as needed in apps like the linked one above purely by listening for the `wheel` event and working with `ev.deltaY`. Here’s an example: https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event#examples.
Not a dup then.
One reason we don't do this when users interact with the screen is that there is no pointer. You'd have to use the centroid of the fingers as the wheel event location, and that's different from what users are used to.
<rdar://problem/83615991>