From 6bf336342948b3470344c7f3eb8d9ee964fbeb0f Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Mar 2024 14:19:55 +0100 Subject: [PATCH] :bug: Fix scroll when file menu open --- frontend/src/app/main/ui/dashboard.cljs | 4 ++++ frontend/src/app/main/ui/dashboard/grid.cljs | 21 +++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/ui/dashboard.cljs b/frontend/src/app/main/ui/dashboard.cljs index 29c41f8e9..4adec8d15 100644 --- a/frontend/src/app/main/ui/dashboard.cljs +++ b/frontend/src/app/main/ui/dashboard.cljs @@ -58,6 +58,9 @@ project-id (:id project) team-id (:id team) + dashboard-local (mf/deref refs/dashboard-local) + file-menu-open? (:menu-open dashboard-local) + default-project-id (mf/with-memo [projects] (->> (vals projects) @@ -83,6 +86,7 @@ [:div {:class (stl/css :dashboard-content) + :style {:pointer-events (when file-menu-open? "none")} :on-click clear-selected-fn :ref container} (case section :dashboard-projects diff --git a/frontend/src/app/main/ui/dashboard/grid.cljs b/frontend/src/app/main/ui/dashboard/grid.cljs index bb2f44b2b..6f5565611 100644 --- a/frontend/src/app/main/ui/dashboard/grid.cljs +++ b/frontend/src/app/main/ui/dashboard/grid.cljs @@ -388,15 +388,18 @@ (on-menu-click event)))} menu-icon (when (and selected? file-menu-open?) - [:& file-menu {:files (vals selected-files) - :show? (:menu-open dashboard-local) - :left (+ 24 (:x (:menu-pos dashboard-local))) - :top (:y (:menu-pos dashboard-local)) - :navigate? true - :on-edit on-edit - :on-menu-close on-menu-close - :origin origin - :parent-id (str file-id "-action-menu")}])]]]]])) + ;; When the menu is open we disable events in the dashboard. We need to force pointer events + ;; so the menu can be handled + [:div {:style {:pointer-events "all"}} + [:& file-menu {:files (vals selected-files) + :show? (:menu-open dashboard-local) + :left (+ 24 (:x (:menu-pos dashboard-local))) + :top (:y (:menu-pos dashboard-local)) + :navigate? true + :on-edit on-edit + :on-menu-close on-menu-close + :origin origin + :parent-id (str file-id "-action-menu")}]])]]]]])) (mf/defc grid [{:keys [files project origin limit library-view? create-fn] :as props}]