diff --git a/src/main/frontend/components/content.cljs b/src/main/frontend/components/content.cljs index 8975df79d7..927145872c 100644 --- a/src/main/frontend/components/content.cljs +++ b/src/main/frontend/components/content.cljs @@ -153,10 +153,13 @@ (rum/use-effect! (fn [] - (let [^js el (rum/deref *el-ref) - {:keys [x y]} (util/calc-delta-rect-offset el js/document.documentElement)] - (set! (.. el -style -transform) - (str "translate3d(" (if (neg? x) x 0) "px," (if (neg? y) (- y 10) 0) "px" ",0)"))) + (js/setTimeout + (fn [] + (let [^js el (rum/deref *el-ref) + {:keys [x y]} (util/calc-delta-rect-offset el js/document.documentElement)] + (set! (.. el -style -transform) + (str "translate3d(" (if (neg? x) x 0) "px," (if (neg? y) (- y 10) 0) "px" ",0)")))) + 10) #()) []) diff --git a/src/main/frontend/components/content.css b/src/main/frontend/components/content.css index 4d60fbc8f8..bd950311b3 100644 --- a/src/main/frontend/components/content.css +++ b/src/main/frontend/components/content.css @@ -13,7 +13,9 @@ #custom-context-menu { @apply rounded-md shadow-lg transition ease-out duration-100 transform - opacity-100 scale-100 absolute; + opacity-100 scale-100 absolute overflow-y-auto; + max-height: calc(100vh - 100px) !important;; + overflow-y: scroll; z-index: calc(var(--ls-z-index-level-1) + 1); -} \ No newline at end of file +} diff --git a/src/main/frontend/handler/common.cljs b/src/main/frontend/handler/common.cljs index e26d888531..5cb278fcca 100644 --- a/src/main/frontend/handler/common.cljs +++ b/src/main/frontend/handler/common.cljs @@ -228,10 +228,15 @@ client-y (gobj/get e "clientY") scroll-y (util/cur-doc-top)] (state/show-custom-context-menu! context-menu-content) - (when-let [context-menu (d/by-id "custom-context-menu")] - (d/set-style! context-menu - :left (str client-x "px") - :top (str (+ scroll-y client-y) "px"))))) + + ;; FIXME: use setTimeout here because rum renders lazily. + (js/setTimeout + (fn [] + (when-let [context-menu (d/by-id "custom-context-menu")] + (d/set-style! context-menu + :left (str client-x "px") + :top (str (+ scroll-y client-y) "px")))) + 10))) (defn parse-config "Parse configuration from file `content` such as from config.edn."