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

We stop propagating the `touchmove` event in the composer to ensure that
the page doesn't scroll inadvertently. We should only do this if no text
is selected, otherwise we block making changes to the text selection on
the `textarea` element.
This commit is contained in:
Penar Musaraj
2025-01-23 12:29:34 -05:00
committed by GitHub
parent 2663cb86ae
commit f1bdd86a8c

View File

@@ -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();
}