Skip to content

A platform for community discussion. Free, open, simple.

FIX: Restore pinch-zoom over the mobile composer editor and inputs (#42303)

chapoi958df722f65c
diff --git a/app/assets/stylesheets/common/base/compose.scss b/app/assets/stylesheets/common/base/compose.scss
index 509ea8fe53b..c5be8d42fa1 100644
--- a/app/assets/stylesheets/common/base/compose.scss
+++ b/app/assets/stylesheets/common/base/compose.scss
@@ -818,8 +818,9 @@ html.composer-open:not(.has-full-page-chat) {
.submit-panel,
.composer-fields {
- // this prevents touch events (i.e. accidental scrolls) from bubbling up
- touch-action: none;
+ // prevents accidental scroll-panning from bubbling up while still
+ // allowing the browser's pinch-zoom gesture
+ touch-action: pinch-zoom;
}
}
diff --git a/frontend/discourse/app/lib/composer/composer-position.js b/frontend/discourse/app/lib/composer/composer-position.js
index 93dbcac5f56..be2cdae9826 100644
--- a/frontend/discourse/app/lib/composer/composer-position.js
+++ b/frontend/discourse/app/lib/composer/composer-position.js
@@ -78,6 +78,11 @@ export function setupComposerPosition(
}
function editorTouchMove(event) {
+ // Multi-touch gestures (e.g. pinch-zoom) must be left to the browser
+ if (event.touches.length > 1) {
+ return;
+ }
+
// This is an alternative to locking up the body
// It stops scrolling in the given element from bubbling up to the body
// when the editor does not have any content to scroll