REOPENED Bug 230545
[iOS] Pinch to zoom gesture should map to mousewheel with the control key
https://bugs.webkit.org/show_bug.cgi?id=230545
Summary [iOS] Pinch to zoom gesture should map to mousewheel with the control key
Thomas Steiner
Reported 2021-09-21 03:57:54 PDT
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
Attachments
Compat table (421.67 KB, image/png)
2021-09-21 03:57 PDT, Thomas Steiner
no flags
Thomas Steiner
Comment 1 2021-09-21 03:59:17 PDT
Addendum: The standards-based Safari way is documented in https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events/Pinch_zoom_gestures.
Alexey Proskuryakov
Comment 2 2021-09-21 09:37:44 PDT
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.
Thomas Steiner
Comment 3 2021-09-21 09:53:52 PDT
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 🚗.
Simon Fraser (smfr)
Comment 4 2021-09-21 10:18:22 PDT
This was implemented in https://bugs.webkit.org/show_bug.cgi?id=225788 *** This bug has been marked as a duplicate of bug 225788 ***
Thomas Steiner
Comment 5 2021-09-21 10:34:41 PDT
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.
Simon Fraser (smfr)
Comment 6 2021-09-21 10:47:39 PDT
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.
Thomas Steiner
Comment 7 2021-09-21 11:24:50 PDT
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?
Simon Fraser (smfr)
Comment 8 2021-09-21 11:33:30 PDT
To be clear, are you expecting pinch-zoom on the iPhone/iPad screen to generate wheel events with the Ctrl key set?
Thomas Steiner
Comment 9 2021-09-21 11:59:54 PDT
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.
Simon Fraser (smfr)
Comment 10 2021-09-21 12:04:27 PDT
Not a dup then.
Simon Fraser (smfr)
Comment 11 2021-09-21 15:33:25 PDT
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.
Radar WebKit Bug Importer
Comment 12 2021-09-28 03:58:15 PDT
Note You need to log in before you can comment on or make changes to this bug.