Skip to content

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

FIX: Allow `touchmove` in composer when there is a selection (#30957)

Penar Musarajf1bdd86a8c9b
diff --git a/app/assets/javascripts/discourse/app/lib/composer/composer-position.js b/app/assets/javascripts/discourse/app/lib/composer/composer-position.js
index ade88b2a233..156bfdfba62 100644
--- a/app/assets/javascripts/discourse/app/lib/composer/composer-position.js
+++ b/app/assets/javascripts/discourse/app/lib/composer/composer-position.js
@@ -13,7 +13,9 @@ export function setupComposerPosition(editor) {
// when the editor does not have any content to scroll
applyBehaviorTransformer("composer-position:editor-touch-move", () => {
const notScrollable = editor.scrollHeight <= editor.clientHeight;
- if (notScrollable) {
+ const selection = window.getSelection();
+
+ if (notScrollable && selection.rangeCount === 0) {
event.preventDefault();
event.stopPropagation();
}