From 2d4fc08f2b4f7a594764ebcd355bc852d17a1b49 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Fri, 2 Feb 2024 10:50:56 -0800 Subject: [PATCH] Desktop: Fixes #9629: Fix horizontal touchpad scrolling of code blocks (#9815) --- packages/app-desktop/gui/note-viewer/index.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/app-desktop/gui/note-viewer/index.html b/packages/app-desktop/gui/note-viewer/index.html index 39aa026da..3dd6b2bb2 100644 --- a/packages/app-desktop/gui/note-viewer/index.html +++ b/packages/app-desktop/gui/note-viewer/index.html @@ -594,12 +594,20 @@ // calculate by yourself by accumulating wheel events. // https://github.com/laurent22/joplin/pull/5496 // When the Electron/Chromium bug is fixed, remove this listener. + // + // 2024-02-01: The bug seems to be fixed, remove the above when we're not in + // feature-freeze. // If scrollTop ever has a fraction part, zoomFactor is not 1. if (zoomFactorIsNotOne || !Number.isInteger(contentElement.scrollTop)) { zoomFactorIsNotOne = true; - customScroll(e, true); - e.preventDefault(); + + // The custom scroll logic breaks horizontal scroll in child DOM nodes + // (e.g. scrollable code blocks). Disable it: + if (e.deltaY !== 0) { + customScroll(e, true); + e.preventDefault(); + } } }));