diff --git a/CHANGES.md b/CHANGES.md index 8a1ed74397..eb2d4d39b0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,7 @@ - Fix problem when creating a layout from an existing layout [Taiga #11554](https://tree.taiga.io/project/penpot/issue/11554) - Fix title button from Title Case to Capitalize [Taiga #11476](https://tree.taiga.io/project/penpot/issue/11476) - Fix Main component receives focus and is selected when using 'Show Main Component' [Taiga #11402](https://tree.taiga.io/project/penpot/issue/11402) +- Fix touchpad swipe leading to navigating back/forth [GitHub #4246](https://github.com/penpot/penpot/issues/4246) ## 2.8.0 diff --git a/frontend/src/app/main/ui.cljs b/frontend/src/app/main/ui.cljs index d5c63a97c5..f92ab7396c 100644 --- a/frontend/src/app/main/ui.cljs +++ b/frontend/src/app/main/ui.cljs @@ -28,6 +28,7 @@ [app.main.ui.onboarding.team-choice :refer [onboarding-team-modal]] [app.main.ui.releases :refer [release-notes-modal]] [app.main.ui.static :as static] + [app.util.dom :as dom] [app.util.i18n :refer [tr]] [app.util.theme :as theme] [beicon.v2.core :as rx] @@ -362,6 +363,8 @@ ;; initialize themes (theme/use-initialize profile) + (dom/prevent-browser-gesture-navigation!) + [:& (mf/provider ctx/current-route) {:value route} [:& (mf/provider ctx/current-profile) {:value profile} (if edata diff --git a/frontend/src/app/util/dom.cljs b/frontend/src/app/util/dom.cljs index c674698a83..d05a8439cc 100644 --- a/frontend/src/app/util/dom.cljs +++ b/frontend/src/app/util/dom.cljs @@ -891,3 +891,12 @@ (defn last-child [^js node] (.. node -lastChild)) + +(defn prevent-browser-gesture-navigation! + [] + ;; Prevent the browser from interpreting trackpad horizontal swipe as back/forth + ;; + ;; In theory We could disable this only for the workspace. However gets too unreliable. + ;; It is better to be safe and disable for the dashboard as well. + (set! (.. js/document -documentElement -style -overscrollBehaviorX) "none") + (set! (.. js/document -body -style -overscrollBehaviorX) "none")) \ No newline at end of file