0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 07:41:43 -05:00

🐛 Fix scroll when file menu open

This commit is contained in:
alonso.torres 2024-03-14 14:19:55 +01:00
parent 3bc6d2b0a7
commit 6bf3363429
2 changed files with 16 additions and 9 deletions

View file

@ -58,6 +58,9 @@
project-id (:id project) project-id (:id project)
team-id (:id team) team-id (:id team)
dashboard-local (mf/deref refs/dashboard-local)
file-menu-open? (:menu-open dashboard-local)
default-project-id default-project-id
(mf/with-memo [projects] (mf/with-memo [projects]
(->> (vals projects) (->> (vals projects)
@ -83,6 +86,7 @@
[:div {:class (stl/css :dashboard-content) [:div {:class (stl/css :dashboard-content)
:style {:pointer-events (when file-menu-open? "none")}
:on-click clear-selected-fn :ref container} :on-click clear-selected-fn :ref container}
(case section (case section
:dashboard-projects :dashboard-projects

View file

@ -388,15 +388,18 @@
(on-menu-click event)))} (on-menu-click event)))}
menu-icon menu-icon
(when (and selected? file-menu-open?) (when (and selected? file-menu-open?)
[:& file-menu {:files (vals selected-files) ;; When the menu is open we disable events in the dashboard. We need to force pointer events
:show? (:menu-open dashboard-local) ;; so the menu can be handled
:left (+ 24 (:x (:menu-pos dashboard-local))) [:div {:style {:pointer-events "all"}}
:top (:y (:menu-pos dashboard-local)) [:& file-menu {:files (vals selected-files)
:navigate? true :show? (:menu-open dashboard-local)
:on-edit on-edit :left (+ 24 (:x (:menu-pos dashboard-local)))
:on-menu-close on-menu-close :top (:y (:menu-pos dashboard-local))
:origin origin :navigate? true
:parent-id (str file-id "-action-menu")}])]]]]])) :on-edit on-edit
:on-menu-close on-menu-close
:origin origin
:parent-id (str file-id "-action-menu")}]])]]]]]))
(mf/defc grid (mf/defc grid
[{:keys [files project origin limit library-view? create-fn] :as props}] [{:keys [files project origin limit library-view? create-fn] :as props}]